/* *****************************************************************************
     JavaScript Advanced Calendar Script (JACS) - Cross-Browser pop-up calendar.

     Copyright (C) 2007-2008  Anthony Garrett

     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     License as published by the Free Software Foundation; either
     version 2.1 of the License, or (at your option) any later version.

     This library is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     Lesser General Public License for more details.

     You should have received a copy of the GNU Lesser General Public
     License along with this library; if not, it is available at
     the GNU web site (http://www.gnu.org/) or by writing to the
     Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
     Boston, MA  02110-1301  USA

*///*****************************************************************************
/*
   Contact:   Sorry, I can't offer support for this but if you find a problem
              (or just want to tell me how useful you find it), please send
              me an email at jacsFeedback@tarrget.info (Note the two Rs in
              tarrget).  I will try to fix problems quickly but this is a
              spare time thing for me.

   Credits:   I wrote this based on my Simple Calendar Widget script which
              I wrote from scratch myself but I couldn't have done either
              without the superb "JavaScript The Definitive Guide" by David
              Flanagan (Pub. O'Reilly ISBN 0-596-00048-0) and Peter-Paul Koch's
              (PPK) brilliant Quirksmode site.

   Link back: Please give me credit and link back to my page if you can.  To
              ensure that search engines give my page a higher ranking you can
              add the following HTML to any indexed page on your web site:

              <A HREF="http://www.tarrget.info/calendar/jacs.htm">
                JavaScript Advanced Calendar Script (JACS) by Anthony Garrett
              </A>

              Your root directory of the web site should also contain an empty
              file called "jacsblank.html". For a full explanation see
              http://www.tarrget.info/calendar/IEnightmare.html.

   Features:  Easily customised (output date format, colours, language,
                                 year range and week start day)
              Accepts a date as input (see comments below for formats).
              Allows multiple calendars on a page and static calendar displays.

              Cross-browser code tested against;
                    Internet Explorer 6.0.28+    Mozilla  1.7.1
                    Opera             7.52+      Firefox  0.9.1+
                    Konqueror         4.0.1      Safari   3 (Beta for Windows)

   How to add the Calendar to your page:
              This script needs to be defined for your page so add the following
              line;
                    <script type='text/JavaScript' src='jacs.js'></script>

   How to use the Calendar once it is defined for your page:

        Dynamic calendar:

              Simply choose an event to trigger the calendar (like an onclick or an onmouseover)
              and an element to work on (for the calendar to take its initial date from and write
              its output date to) then write it like this;

                    onclick="JACS.show(document.getElementById('myElement'),event);"
                or
                    onfocus="JACS.show(this,event);"

              NOTE: If you wish to use the calendar with an Anchor tag, do not use the
                    href="javascript:JACS.show(...)" syntax.

                    Instead you should use the following;

                    <a href="#" onclick="JACS.show(<<element>>,event);return false;">
                        <<your text>>
                    </a>

              If you are using a text node then specify the text's parent node in the
              function call. The date should be the only text under that node;

                    <p onclick="JACS.show(this,event);"><<date>></p>

        Static calendar:

                    JACS.show(<<element>><<,optional calendar ID>><<,optional disabled days>>);

              A static calendar appears on screen when the page loads, cannot be dragged and
              remains on screen after it has been used to select a date. It returns the date
              into the value of a defined element (e.g. an INPUT element) but, of course,
              that can be hidden.

        Calendar with selected days:

              You can select days of the week by adding arguments to the
              call to JACS.show. These selected days can be the only ones
              enabled or the only ones disabled depending on the setting of
              the attribute valuesEnabled (see below). The values should be
              Sunday = 0 through to Saturday = 6. The parameters can be a
              series of single values or an array holding those values. A call
              to JACS.show with Friday and Monday selected could look something
              like this;

                        JACS.show(<<element>>,event,5,1);
              or this;
                        var myArray = [5,1];
                        JACS.show(<<element>>,event,myArray);

        Named calendar:

                    JACS.show(<<element>>,event<<,calendar ID>>);

              'jacs' is the default ID of the calendar but you can assign any ID
              you want.  You can call one name as many times as you like,
              but as it is one object, it can only appear on screen in one location
              at a time.  If you want more than that then you must give different IDs.

              [Note: in the above paragraph I use "name" and "id" interchangeably, not
                     in the sense of HTML tag attributes "name" and "id". ]

        No event? No problem!

              Normally the calendar will be triggered by an event but if you wish to
              control it in code and the event is not available to you, simply pass
              an element as the second parameter;

              E.G.  JACS.show(<<target element>>,<<source element>>);
                    as in: JACS.show(this,this);

        Calendar with post-processing:

              The following technique runs a function each time a dynamic calendar
              closes or a date is selected from a static calendar:

                    JACS.show(<<Dynamic or Static calendar argument list>>);
                    JACS.next(<<optional calendar ID,>><<function>><<,arguments>>);

              Where <<function>> is a function defined on the calling page
              and <<arguments>> is the list of arguments being passed to that
              function.

              The calendar ID defaults to 'jacs', if you are using a different
              calendar object (See calendar naming above), you must give its
              ID as the first argument.

              NOTES: These two calls are expected in this order (i.e. show before
                     next) because JACS.next expects the calendar object to exist.

                     If JACS.make has not been called for the object and JACS.show
                     is called after JACS.next then the calendar object may not
                     exist (if the object has not been created earlier in the
                     users path through the page) so a JavaScript error would
                     be generated.

              Every function that is triggered using JACS.next() acquires an
              attribute JACSid. This attribute holds the value of the
              calendar ID that JACS.next() has been called for. So, your
              function has access to all of the calendar instance's attributes.
              These include;
                dateReturned  Boolean TRUE if the calendar has been closed by
                              selection of a date, otherwise FALSE), and
                outputDate    The user-selected date in JavaScript date format.

                    E.G. document.getElementById(<<function>>.JACSid).dateReturned

        Disabling or enabling dates or date ranges;

              Setting enabled or disabled date ranges for a calendar object is
              achieved by setting the dates array attribute of the calendar object
              (see more information below).

              By default the calendar object is only created when it is first
              needed for display so you should make sure that it is explicitly
              created using;

                    JACS.make(<<calendar id>><<,dynamic (boolean, default TRUE)>>);

        Combining the techniques:

              A fully defined call to JACS.show, including all optional parameters
              should send parameters in the following order;

                            I/O      Trigger  Calendar  Selected
                            Element  Event    ID        days
              Dynamic         0        1        2         2/3
              Static          0                 1         1/2
              Type          Object   Object   String    Number(s)
              Required      Yes      Yes      No        No
              Default       None     None     'jacs'    None

              NOTE: The Trigger Event is ONLY relevant for dynamic calendars
                    and must be omitted for static calendars.

              Dynamic e.g.  JACS.show(document.getElementById('myElement1'),
                                      event,'jacs',0,1,2,3,4,5,6);

              Static  e.g.  JACS.show(document.getElementById('myElement2'),
                                           'myCal',0,6);

              A single calendar instance must not be called with both Dynamic
              and Static parameters (It is only one structure within the page
              so it cannot remain visible in one location while it is displayed
              in another).

----------------------------------------------------------------------------------
   See http://www.tarrget.info/calendar/scw.htm for a full version history
   up to version 3.60 and
       http://www.tarrget.info/calendar/jacs.htm for versions to date.

   Version   Date        By               Description
   =======   ====        ===============  ===========
     1.30    2008-05-05  Anthony Garrett  Added optional auto-positioning of the
                                           calendar when its normal position would
                                           go off the visible area.
                                           Thanks to Chandramouli Iyer for this
                                           suggestion.
                                          Added an optional "Clear" button for
                                           use when handling a read-only text
                                           input element. Thanks to Sanjay Gangwal
                                           for his suggestion.

     1.21    2008-04-11  Anthony Garrett  Corrected the input month name parsing
                                            so that it set the calendar to the
                                            right month when long month names used.
                                            Thanks to Ben Diamand for this bug report.

     1.20    2008-04-10  Anthony Garrett  Added attribute to allow calendar to
                                           appear in "display" mode only (i.e.
                                           dates not selectable.

                                          Added the option to highlight specified
                                           dates and date ranges.

                                          Thanks to Ben Diamand for both
                                           suggestions.

     1.11    2008-02-24  Anthony Garrett  Trapped calls to script with only a
                                           NAME attribute is set for the target
                                           element when the script really requires
                                           an ID attribute.  This is the most
                                           frequent mistake reported to me.

     1.10    2008-01-14  Anthony Garrett  Restored the ability to use an element
                                           as the second parameter when opening a
                                           dynamic calendar while retaining the
                                           option of passing an event. Thanks to
                                           Thierry Blind and Sergey Snovsky for
                                           the feedback.

                                          Added a calendar attribute that holds the
                                           returned date. This simplifies use of
                                           the calendar within JavaScript. Thanks
                                           to Juha Valvanne for the query that
                                           led to this enhancement.

                                          Fixed bug in the handling of focus events
                                           that caused calendar to fail to appear.
                                           Thanks to Steve Davis for reporting the
                                           problem.

     1.00    2007-09-21  Anthony Garrett  Fixed JACS.next parameters - thanks to
                                           Rogier Lankhorst for the feedback, also
                                           refined JACS.next processing.

                                          Updated the event trapping to make it
                                           less intrusive on the page body.  NOTE:
                                           This requires that a dynamic calendar's
                                           second parameter should be the calling
                                           event (not the calling object as in
                                           previous versions).  Thanks to Steve
                                           Davis for the bug report that led to
                                           this change.

                                          Replaced the date input sequence user
                                           configuration setting with parsing the
                                           sequence from the full format. New users
                                           are often confused by the sequence and
                                           in practice (to allow the calendar's date
                                           output to be used for input) the sequence
                                           must always match the full format element
                                           order.

                                          Fixed a bug that caused undelimited
                                           dates to be handled incorrectly. They
                                           are now parsed against the full date
                                           output format then checked for validity.
                                           Thanks to Dan Wood for raising this bug.

                                          Fixed Standards-based (non IE)
                                           calendar dragging which wasn't releasing
                                           the calendar onmouseup.

                                          Fixed problem where selected weekdays
                                           carried over from one call to another
                                           on the same calendar object.

                                          Corrected the Month and Year select box
                                           displays in Opera. They were not changing
                                           when the month was shifted using the
                                           calendar's left and right arrows.

                                          Extended IFRAME backing to all calendar objects
                                           in order to improve calendar display over
                                           some embedded applets and objects.  Thanks to
                                           Stanko Kupcevic for his feedback on this.
                                           NOTE: It is not possible to protect any
                                           JavaScript object displayed over an
                                           embedded DYNAMIC (and, therefore refreshed)
                                           object because browsers usually do not
                                           directly control the screen handling within
                                           the object.  The best advice therefore remains
                                           to design pages in such a way that the calendar
                                           does not overlap embedded objects.

                                         Added curly braces and semi-colons
                                           for best practice and for robustness
                                           when code is compacted/obfuscated.

     0.90    2007-04-04  Anthony Garrett  Major re-write of the script to allow
                                           multiple calendar objects visible on
                                           on the page, and to allow static
                                           calendars. Dropped the legacy
                                           "showCal" entry-point function.

                                          Added ability to select calendar
                                           position relative to return value
                                           element.  Thanks to Justin Lawrence
                                           for that request.

*///*****************************************************************************

// ********************************************************
// Start of Javascript Advanced Calendar Script (JACS) Code
// ********************************************************

/* *****************************************************************************

    EXPOSED CALENDAR OBJECTS (FUNCTIONS):

        JACS.make   Creates calendar objects;
                        is called as part of JACS.show (if needed) but can also
                        be called to create a calendar instance at any time.

        JACS.show   Entry point for display of a calendar: Called in main page.

        JACS.next   Sets up a function that runs when a date is selected on a
                    static calendar or a dynamic calendar moves or closes.

        JACS.cals   returns an array of all the calendar IDs that have been
                    used on the page.

                    NOTES: 1 "used" here means: Invoked with JACS.make or JACS.show.
                             Calls without a defined calendar ID invoke the default
                             ID, 'jacs'.

                           2 Each calendar structure is added to the page when it
                             is first used. So this array may not hold all dynamic
                             calendar IDs that are defined on the page.  If you
                             want to be sure that the array does show all of them,
                             explicitly invoke  JACs.make(<<ID>>); for each ID on
                             page load.

*///*****************************************************************************

//  Namespace JACS
//  --------------
//  This namespace encapsulates all the calendar script code eliminating
//  naming conflicts between the JavaScript in this script and your calling
//  page(s) [as long as you don't use JACS as a variable of course].  It is
//  still possible for CSS inheritance to cause problems but that is unavoidable.

var JACS = new function()
    {// This date is used throughout to determine today's date.
     var dateNow = new Date(Date.parse(new Date().toDateString()));

     // This array keeps track of the defined calendars for the page.
     var cals = new Array();
     var _dList=new Array();
     var _bYear,_dYear;
     var _fDay, _bDay;
     var _xBase;

     // This function shortens the code replacing
     // document.getElementById('myID') with getEl('myId')
     // everywhere in the script. It also tries to handle a common
     // error when calling the script: when the developer has only
     // set a NAME attribute value, so no ID attribute is set.
     function getEl(id)
         {if (document.getElementById(id) || (!document.getElementById(id) && document.getElementsByName(id).length==0))
                                    // IF   An ID attribute is assigned
                                    // OR   No ID attribute is assigned but using IE and Opera
                                    //          (which will find the NAME attribute value using getElementById)
                                    // OR   No element has this ID or NAME attribute value
                                    //          (used internally by the script)
                                    // THEN Return the required element.
                {return document.getElementById(id);}
          else  {if (document.getElementsByName(id).length==1)
                                    // IF   No ID attribute is assigned
                                    // AND  Using a standards-based browser
                                    // AND  Only one element has the NAME attribute set to the value
                                    // THEN Return the required element (using the NAME attribute value).
                        {return document.getElementsByName(id)[0];}
                 else   {if (document.getElementsByName(id).length>1)
                                {   // IF   No ID attribute is assigned
                                    // AND  using a standards-based browser
                                    // AND  more than one element has the NAME attribute set to the value
                                    // THEN alert developer to fix the fault.
                                 alert( 'JACS' +
                                        ' \nCannot uniquely identify element named: ' + id +
                                        '.\nMore than one identical NAME attribute defined' +
                                        '.\nSolution: Assign the required element a unique ID attribute value.');
                                }
                        }
                }
         };


     function calAttributes(cal)
        {switch (cal.id)
            {case 'EnterYourIDHere':

                // If you want to vary the attributes for a specific instance
                // of the calendar, replace 'EnterYourIDHere' (above) with the
                // ID that you have defined for that calendar then amend and
                // uncomment the block-commented section below (which is just
                // a copy of the default section below with all the
                // documentation comments removed).

                /*

                cal.zIndex                   = 1;
                cal.baseYear                 = dateNow.getFullYear()-10;
                cal.dropDownYears            = 20;
                cal.weekStart                = 1;
                cal.weekNumberBaseDay        = 4;
                cal.weekNumberDisplay        = false;

                try   {jacsSetLanguage(cal);}
                catch (exception)
                    {cal.today               = 'Today:';
                     cal.clear               = 'Clear';
                     cal.drag                = 'click here to drag';
                     cal.monthNames          = ['Jan','Feb','Mar','Apr','May','Jun',
                                                'Jul','Aug','Sep','Oct','Nov','Dec'];
                     cal.weekInits           = ['S','M','T','W','T','F','S'];
                     cal.invalidDateMsg      = 'The entered date is invalid.\n';
                     cal.outOfRangeMsg       = 'The entered date is out of range.';
                     cal.doesNotExistMsg     = 'The entered date does not exist.';
                     cal.invalidAlert        = ['Invalid date (',') ignored.'];
                     cal.dateSettingError    = ['Error ',' is not a Date object.'];
                     cal.rangeSettingError   = ['Error ',' should consist of two elements.'];
                    }

                cal.showInvalidDateMsg       = true;
                cal.showOutOfRangeMsg        = true;
                cal.showDoesNotExistMsg      = true;
                cal.showInvalidAlert         = true;
                cal.showDateSettingError     = true;
                cal.showRangeSettingError    = true;
                cal.delimiters               = ['/','-','.',':',',',' '];
                cal.dateDisplayFormat        = 'dd-mm-yy';
                cal.dateFormat               = 'DD MMM, YYYY';
                cal.strict                   = false;
                cal.dates                    = new Array();
                cal.higlightDates            = new Array();
                cal.dayCells                 = [true, true, true, true, true, true, true,
                                                true, true, true, true, true, true, true,
                                                true, true, true, true, true, true, true,
                                                true, true, true, true, true, true, true,
                                                true, true, true, true, true, true, true,
                                                true, true, true, true, true, true, true];
                cal.outOfRangeDisable        = true;
                cal.outOfMonthDisable        = false;
                cal.outOfMonthHide           = false;
                cal.formatTodayCell          = true;
                cal.todayCellBorderColour    = 'red';
                cal.allowDrag                = false;
                cal.onBlurMoveNext           = false;
                cal.clickToHide              = false;
                cal.xBase                    = 'L';    // L Left, M Middle, R Right  or integer pixel offset from left
                cal.yBase                    = 'B';    // T Top,  M Middle, B Bottom or integer pixel offset from top
                cal.xPosition                = 'L';    // L Left, M Middle, R Right  or integer pixel offset from left
                cal.yPosition                = 'T';    // T Top,  M Middle, B Bottom or integer pixel offset from top
                cal.autoPosition             = true;
                */

                break;
             default:

                // cal.zIndex controls how the pop-up calendar interacts with
                // the rest of the page.  It is usually adequate to leave it
                // as 1 (One) but I have made it available here to help anyone
                // who needs to alter the level in order to ensure that the
                // calendar displays correctly in relation to all other elements
                // on the page.

                cal.zIndex = 1;

                // Set the bounds for the calendar here...
                // If you want the year to roll forward you can use something
                // like this...
                //      var baseYear = dateNow.getFullYear()-5;
                // alternatively, hard code a date like this...
                //      var baseYear = 1990;

                cal.baseYear = dateNow.getFullYear()+(_bYear!=undefined?_bYear:-10);

                // How many years do want to be valid and to show in the
                // drop-down list?

                cal.dropDownYears = _dYear?_dYear:20;

                // weekStart determines the start of the week in the display
                // Set it to: 0 (Zero) for Sunday, 1 (One) for Monday etc..

                // Note:  Always start the weekInits array with your
                //        string for Sunday whatever weekStart (below)
                //        is set to.

                cal.weekStart = 0;

                // Week numbering rules are generally based on a day in the week
                // that determines the first week of the year.  ISO 8601 uses
                // Thursday (day four when Sunday is day zero).  You can alter
                // the base day here.

                // See http://www.cl.cam.ac.uk/~mgk25/iso-time.html
                // for more information

                cal.weekNumberBaseDay = 4;

                // The week start day for the display is taken as the week start
                // for week numbering.  This ensures that only one week number
                // applies to one line of the calendar table.
                // [ISO 8601 begins the week with Day 1 = Monday.]

                // If you want to see week numbering on the calendar, set
                // this to true.  If not, false.

                cal.weekNumberDisplay = false;

                // If the calendar is given a date that it can't parse a month
                // from, it will use a default month.  If the following attribute
                // is FALSE then the default month is month 6 (June), if set to
                // TRUE then the default will be the current month.

                cal.defaultToCurrentMonth = false;

                // All language-dependent settings can be made here...

                // If you wish to work in a single language (other than English)
                // then just replace the English below with your own text.

                // Using multiple languages:
                // In order to keep this script to a resonable size I have not
                // included multiple languages here.  However, you can set the language
                // fields in a function that you should name  jacsSetLanguage.  The script
                // will then use your languages. I have included all the translations
                // that have been sent to me in such a function on my demonstration
                // site at http://www.tarrget.info/calendar/jacsLanguages.js.

                // gb
                cal.language            = 'gb';
                cal.today               = '今天:';
                cal.clear               = '清除';
                cal.drag                = 'click here to drag';
                cal.monthNames          = ['1月','2月','3月','4月','5月','6月',
                                           '7月','8月','9月','10月','11月','12月'];
                cal.weekInits           = ['日','一','二','三','四','五','六'];
                cal.invalidDateMsg      = 'The entered date is invalid.\n';
                cal.outOfRangeMsg       = 'The entered date is out of range.';
                cal.doesNotExistMsg     = 'The entered date does not exist.';
                cal.invalidAlert        = ['Invalid date (',') ignored.'];
                cal.dateSettingError    = ['Error ',' is not a Date object.'];
                cal.rangeSettingError   = ['Error ',' should consist of two elements.'];

                // Each of the calendar's alert message types can be disabled
                // independently here.

                cal.showInvalidDateMsg      = false;
                cal.showOutOfRangeMsg       = true;
                cal.showDoesNotExistMsg     = true;
                cal.showInvalidAlert        = true;
                cal.showDateSettingError    = true;
                cal.showRangeSettingError   = true;

                // Set the whole calendar as active (dates selectable)
                // or inactive (display only)

                cal.active = true;

                // Set the allowed input date delimiters here...
                // E.g. To set the rising slash, hyphen, full-stop (aka stop or
                //      point), colon, comma and space as delimiters use
                //              var cal.delimiters   = ['/','-','.',':',',',' '];

                cal.delimiters = ['/','-','.',':',',',' '];

                // Set the format for the displayed 'Today' date and for the
                // output date here.
                //
                // The format is described using delimiters of your choice (as
                // set in cal.delimiters above) and case insensitive letters
                // D, M and Y.
                //
                // NOTE: If no delimiters are input then the date output format is used
                //       to parse the value.  This allows less flexiblility in the input
                //       value than using delimiters but an accurately entered date
                //       remains parsable.

                // Displayed "Today" date format

                //cal.dateDisplayFormat = 'dd/mm/yyyy';     // e.g. 'MMM-DD-YYYY' for the US
                cal.dateDisplayFormat = 'yyyy/MM/dd';

                // Output date format

                //cal.dateFormat  = 'DD-MMM-YYYY'; // e.g. 'MMM-DD-YYYY' for the US
                cal.dateFormat  = 'yyyy-M-d';
                
                // Note: The delimiters used should be in cal.delimiters.

                // Personally I like the fact that entering 31-Sep-2005 (a date
                // that doesn't exist) displays 1-Oct-2005, however you may want
                // that to be an error.  If so, set cal.strict = true.  That
                // will cause an error message to display and the selected month
                // is displayed without a selected day. Thanks to Brad Allan for
                // his feedback prompting this feature.

                cal.strict = false;

                // If you are using ReadOnly or diaabled fields to return the date
                // value into, it can be useful to show a button on the calendar
                // that allows  the value to be cleared.  If you want to do that,
                // set cal.clearButton = true;

                cal.clearButton = true;

                // Choose whether the dates and days you specify in cal.dates
                // and as parameters to the JACS.show call are enabled (with all
                // other dates disabled) or disabled (with all other dates enabled).

                cal.valuesEnabled = false;

                // If you wish to set any displayed day, e.g. Every Monday,
                // you can do it using the following array.  The array elements
                // match the displayed cells.
                //
                // With the valuesEnabled attribute FALSE you could put something
                // like the following in your calling page to disable all weekend
                // days;
                //
                //  for (var i=0;i<<<calendar object>>.dayCells.length;i++)
                //      {if (i%7%6==0) <<calendar object>>.dayCells[i] = false;}
                //
                // The above approach will allow you to select days of the week
                // for the whole of your page easily.  If you need to set different
                // selected days for a number of date input fields on your page
                // there is an easier way: You can pass optional arguments to
                // JACS.show. The syntax is described at the top of this script in
                // the section:
                //    "How to use the Calendar once it is defined for your page:"
                //
                // It is possible to use these two approaches in combination.

                cal.dayCells = [true, true, true, true, true, true, true,
                                true, true, true, true, true, true, true,
                                true, true, true, true, true, true, true,
                                true, true, true, true, true, true, true,
                                true, true, true, true, true, true, true,
                                true, true, true, true, true, true, true];

                // You can specify any date (e.g. 24-Jan-2006 or Today) by creating
                // an element of the array cal.dates as a date object with the
                // value you want to handle.  Date ranges can be handled by placing
                // an array of two values (Start and End) into an element of this array.
                //
                // Use cal.valuesEnabled to determine whether any specified dates
                // are treated as the only enabled ones or the only disabled ones.

                cal.dates = new Array();
                
                // add by c
                if(_dList.length>0)
                {
                	for(var i=0;i<_dList.length;cal.dates.push(_dList[i++]));
                }
               	if (_fDay!=undefined && _bDay!=undefined) {
                	cal.dates.push(
                    	[new Date(cal.baseYear,0,0),
                         new Date(dateNow.getFullYear(),
                         dateNow.getMonth(),
                         dateNow.getDate()+_fDay)]);
                	cal.dates.push(
                    	[new Date(dateNow.getFullYear(),
                         dateNow.getMonth(),
                         dateNow.getDate()+_fDay+_bDay+1),
                         new Date(cal.dropDownYears+cal.baseYear,12,31)]);
                }
				else if (_fDay!=undefined)
					cal.dates.push(
						[new Date(cal.baseYear,0,1),
						new Date(dateNow.getFullYear(),
						dateNow.getMonth(),
						dateNow.getDate()+_fDay)]);

                // e.g. To specify 10-Dec-2005:
                //          cal.dates[0] = new Date(2005,11,10);
                //
                //      Or a range from 2004-Dec-25 to 2005-Jan-01:
                //
                //          cal.dates[1] =
                //              [new Date(2004,11,25),new Date(2005,0,1)];
                //
                //      The following will specify all calendar dates up to
                //      yesterday:
                //
                //          cal.dates[2] =
                //              [new Date(cal.baseYear,0,1),
                //               new Date(dateNow.getFullYear(),
                //                        dateNow.getMonth(),
                //                        dateNow.getDate()-1)];
                //
                // Remember that Javascript months are zero-based.

                // Allow specified dates to be highlighted when they are enabled.
                // You can set individual dates or date ranges in the same way as
                // above.

                cal.highlightDates = new Array();

                // Dates that are out of the specified range can be displayed at
                // the start of the very first month and end of the very last.
                // Set outOfRangeDisable = true to disable these dates
                // (or false to allow their selection).

                cal.outOfRangeDisable = true;

                // Dates that are out of the displayed month are shown at the start
                // (unless the month starts on the first day of the week) and end of
                // each month. Set outOfMonthDisable = true to disable these dates
                // (or false to allow their selection). Set outOfMonthHide = true
                // to hide these dates (or false to make them visible).

                cal.outOfMonthDisable = false;
                cal.outOfMonthHide    = false;

                // If you want a special format for the cell that contains the current day
                // set this to true.  This sets a thin border around the cell in the colour
                // set by cal.todayCellBorderColour.

                cal.formatTodayCell = true;
                cal.todayCellBorderColour = '#f00'; // red

                // You can allow the calendar to be dragged around the screen by
                // using the setting allowDrag = true.
                // I can't say I recommend it because of the danger of the user
                // forgetting which date field the calendar will update when
                // there are multiple date fields on a page.

                cal.allowDrag = false;

                // It is not easy to code HTML events to make the focus move
                // automatically on to the next element in the tab order so
                // here is a parameter you can set that will tell the script
                // to do it for you.  NOTE: The script may have to build a list
                // of all the page's elements in tabIndex order to achieve this
                // so there can be an overhead to using this feature.

                cal.onBlurMoveNext = false;

                // You can allow a click on the calendar to close dynamic
                // calendars by setting clickToHide = true.  If set to false
                // the script will hide a dynamic calendar when a date is
                // selected or the main page is clicked.

                cal.clickToHide = false;

                // Dynamic calendar positioning is relative to the return value
                // element. The script is supplied with the parameters below
                // setting the calendar's top left corner to appear at the
                // return element's bottom left corner.

                //cal.xBase     = 'L';
                cal.xBase     =  _xBase?_xBase:'L';
                cal.yBase     = 'B';
                cal.xPosition = 'L';
                cal.yPosition = 'T';

                // For the horizontal (X) parameters, xBase and xPosition,
                // the accepted values are;  L - Left
                //                           M - Middle
                //                           R - Right
                //                      or  nn - integer pixel offset from left +/-
                //
                // For the vertical (Y) parameters, yBase and yPosition,
                // the accepted values are;  T - Top
                //                           M - Middle
                //                           B - Bottom
                //                      or  nn - integer pixel offset from top +/-

                // The calendar will position itself aligned according to the
                // choices above.  If automatic positioning is turned
                // on  with  cal.autoPosition = true  then if the chosen position
                // would cause the calendar to display off the visible screen,
                // it is shifted to a position that is visible.

                cal.autoPosition = true;

            }

            // Do not set the value of this calendar attribute.  It is used
            // to tell you whether a date has been selected or not when
            // using the JACS.next feature to trigger a function after the
            // calendar is used.
            // dateReturned is False unless the user has clicked on an
            // active date cell or the value for "Today", in which case
            // it is True.

            cal.dateReturned  = false;

            // The most recent date output to the target element is stored
            // as an attribute of the calendar. Initialised to Midnight
            // on 1st January 1970 (UTC), a selected date can never
            // equal this because returned dates are always 12 Midday.

            cal.outputDate    = new Date(0);

            // Finally: The following attributes are used in calendar
            //          functions.  You need do nothing with them here.

            cal.seedDate      = new Date();
            cal.fullInputDate = false;
            cal.activeToday   = true;
            cal.monthSum      = 0;
            cal.days          = new Array();
            cal.arrOnNext     = new Array();
            cal.triggerEle;
            cal.targetEle;
        };

//******************************************************************************
//------------------------------------------------------------------------------
// End of customisation section
//------------------------------------------------------------------------------
//******************************************************************************

// *******************************************************
// Custom methods for Date, String and Function prototypes
// *******************************************************

     // Format a date into the required pattern

     Date.prototype.jacsFormat =
        function(format,monthNames)
            {var charCount = 0,
                 codeChar  = '',
                 result    = '';

             for (var i=0;i<=format.length;i++)
                {if (i<format.length && format.charAt(i)==codeChar)
                        {// If we haven't hit the end of the string and
                         // the format string character is the same as
                         // the previous one, just clock up one to the
                         // length of the current element definition
                         charCount++;
                        }
                 else   {switch (codeChar)
                            {case 'y': case 'Y':
                                result += (this.getFullYear()%Math.pow(10,charCount)).toString().jacsPadLeft(charCount);
                                break;
                             case 'm': case 'M':
                                // If we find an M, check the number of them to
                                // determine whether to get the month number or
                                // the month name.
                                result += (charCount<3)
                                            ?(this.getMonth()+1).toString().jacsPadLeft(charCount)
                                            :monthNames[this.getMonth()];
                                break;
                             case 'd': case 'D':
                                // If we find a D, get the date and format it
                                result += this.getDate().toString().jacsPadLeft(charCount);
                                break;
                             default:
                                // Copy any unrecognised characters across
                                while (charCount-->0) {result += codeChar;}
                            }

                         if (i<format.length)
                            {// Store the character we have just worked on
                             codeChar  = format.charAt(i);
                             charCount = 1;
                            }
                        }
                }
             return result;
            };

     // Left pad zeroes

     String.prototype.jacsPadLeft =
        function(padToLength)
            {var result = '';
             for (var i=0;i<(padToLength-this.length);i++) {result += '0'};
             return (result+this);
            };

     // Set up a closure so that any next function can be triggered after the calendar
     // has been closed AND that function can take arguments.

     Function.prototype.jacsRunNext =
        function()  {var func = this, args = arguments[0];
                     func.JACSid = arguments[1];
                     return function() {return func.apply(this, args);};
                    };

// **************************************
// Set up calendar events on calling page
// **************************************

     if (document.addEventListener)
          {window.addEventListener(  'load',jacsLoader,true);}
     else {window.attachEvent     ('onload',jacsLoader);}

     function jacsLoader()
        {// Define document level event to hide the calendar on click.

         if (document.addEventListener)
              {document.addEventListener('click',hide, false);}
         else {document.attachEvent('onclick',hide);}

         // Create an onBeforeUnload event to handle IE memory leaks.

         if (getEl('jacsIElt7')) {window.attachEvent('onbeforeunload',defeatLeaks);}

         function defeatLeaks()
            {for (var i=0;i<cals.length;i++)
                {// Display the week number column (header and row numbers).
                 getEl(cals[i]+'Week_').style.display='';

                 for (var j=0;j<6;j++) {getEl(cals[i]+'Week_'+j).style.display='';}

                 // Set events to null.

                 getEl(cals[i]+'Now').onclick         = null;
                 getEl(cals[i]+'Now').onmouseover     = null;
                 getEl(cals[i]+'Now').onmouseout      = null;
                 getEl(cals[i]+'ClearButton').onclick = null;

                 var cal    = getEl(cals[i]),
                     cells  = getEl(cals[i]+'Cells').childNodes;

                 for (var j=0;j<cells.length;j++)
                    {var rows = cells[j].childNodes;
                     for (var k=1;k<rows.length;k++)
                        {rows[k].onclick     = null;
                         rows[k].onmouseover = null;
                         rows[k].onmouseout  = null;
                        }
                    }

                 // Set calendar's leaky custom attributes to null.

                 cal.arrOnNext  = null;
                 cal.targetEle  = null;
                }
            };
        };

// ****************************************************************************
// Start of Main Private Function Library
// ****************************************************************************

     function showMonth(bias,calId)
        {// Set the selectable Month and Year
         // May be called: from the left and right arrows
         //                  (shift month -1 and +1 respectively)
         //                from the month selection list
         //                from the year selection list
         //                from the showCal routine
         //                  (which initiates the display).
         var cal       = getEl(calId),
             showDate  = new Date(Date.parse(new Date().toDateString())),
             startDate = new Date();

         // Set the time to the middle of the day so that the handful of
         // regions that have daylight saving shifts that change the day
         // of the month (i.e. turn the clock back at midnight or forward
         // at 23:00) do not mess up the date display in the calendar.

         showDate.setHours(12);

         selYears  = getEl(calId+'Years');
         selMonths = getEl(calId+'Months');

         if ( selYears.options.selectedIndex>-1) {cal.monthSum =12*(selYears.options.selectedIndex)+bias;}
         if (selMonths.options.selectedIndex>-1) {cal.monthSum+=selMonths.options.selectedIndex;}

         showDate.setFullYear(cal.baseYear+Math.floor(cal.monthSum/12),(cal.monthSum%12),1);

         // If the Week numbers are displayed, shift the week day names to the right.

         getEl(calId+'Week_').style.display = (cal.weekNumberDisplay)?'':'none';

         // Opera has a bug with setting the selected index.
         // It requires the following work-around to force SELECTs to display correctly.
         if (window.opera)
            {selMonths.style.display = 'inherit';
              selYears.style.display = 'inherit';
            }

         tmp = (12*parseInt((showDate.getFullYear()-cal.baseYear),10)) + parseInt(showDate.getMonth(),10);

         if (tmp > -1 && tmp < (12*cal.dropDownYears))
            {selYears.options.selectedIndex  = Math.floor(cal.monthSum/12);
             selMonths.options.selectedIndex = (cal.monthSum%12);

             curMonth = showDate.getMonth();

             showDate.setDate((((showDate.getDay()-cal.weekStart)<0)?-6:1)+cal.weekStart-showDate.getDay());

             var compareDateValue = new Date(showDate.getFullYear(),showDate.getMonth(),showDate.getDate()).valueOf();

             startDate = new Date(showDate);

             var now = getEl(calId+'Now');

             function nowOutput() {setOutput(dateNow,calId);};

             if (cal.dates.length==0)
                {if (cal.active && cal.activeToday)
                    {now.onclick   = nowOutput;
                     now.className = 'jacsNow';

                     if (getEl('jacsIE'))
                        {now.onmouseover = changeClass;
                         now.onmouseout  = changeClass;
                        }

                     if (document.removeEventListener)
                            {now.removeEventListener('click',stopPropagation,false);}
                     else   {now.detachEvent(      'onclick',stopPropagation);}
                    }
                 else
                    {now.onclick   = null;
                     now.className = 'jacsNowDisabled';

                     if (getEl('jacsIE'))
                        {now.onmouseover = null;
                         now.onmouseout  = null;
                        }

                     if (document.addEventListener)
                            {now.addEventListener('click',stopPropagation,false);}
                     else   {now.attachEvent(   'onclick',stopPropagation);}
                    }
                }
             else
                {for (var k=0;k<cal.dates.length;k++)
                    {if (!cal.activeToday ||
                         (typeof cal.dates[k]=='object' &&
                              ((cal.dates[k].constructor==Date  && dateNow.valueOf() == cal.dates[k].valueOf()) ||
                               (cal.dates[k].constructor==Array && dateNow.valueOf() >= cal.dates[k][0].valueOf() &&
                                                                   dateNow.valueOf() <= cal.dates[k][1].valueOf()
                               )
                              )
                         )
                        )
                        {now.onclick   = (cal.active && cal.valuesEnabled)?nowOutput:null;
                         now.className = (cal.active && cal.valuesEnabled)?'jacsNow':'jacsNowDisabled';

                         if (getEl('jacsIE'))
                            {now.onmouseover = (cal.active && cal.valuesEnabled)?changeClass:null;
                             now.onmouseout  = (cal.active && cal.valuesEnabled)?changeClass:null;
                            }

                         if (cal.active && cal.valuesEnabled)
                            {if (document.removeEventListener) {now.removeEventListener('click',stopPropagation,false);}
                             else                              {now.detachEvent(      'onclick',stopPropagation);}
                            }
                         else
                            {if (document.addEventListener) {now.addEventListener('click',stopPropagation,false);}
                             else                           {now.attachEvent(   'onclick',stopPropagation);}
                            }

                         break;
                        }
                     else
                        {now.onclick   = (cal.active && cal.valuesEnabled)?null:nowOutput;
                         now.className = (cal.active && cal.valuesEnabled)?'jacsNowDisabled':'jacsNow';

                         if (getEl('jacsIE'))
                            {now.onmouseover = (cal.active && cal.valuesEnabled)?null:changeClass;
                             now.onmouseout  = (cal.active && cal.valuesEnabled)?null:changeClass;
                            }

                         if (cal.active && cal.valuesEnabled)
                            {if (document.addEventListener) {now.addEventListener('click',stopPropagation,false);}
                             else                           {now.attachEvent(   'onclick',stopPropagation);}
                            }
                         else
                            {if (document.removeEventListener) {now.removeEventListener('click',stopPropagation,false);}
                             else                              {now.detachEvent(      'onclick',stopPropagation);}
                            }
                        }
                    }
                }

             function setOutput(outputDate,calId)
                {var cal = getEl(calId);

                 if (typeof cal.targetEle.value == 'undefined')
                        {cal.triggerEle.textNode.replaceData(0,cal.triggerEle.len,outputDate.jacsFormat(cal.dateFormat,cal.monthNames));}
                 else   {cal.ele.value = outputDate.jacsFormat(cal.dateFormat,cal.monthNames);}

                 cal.dateReturned = true;
                 cal.outputDate   = outputDate;

                 if (cal.dynamic) {hide(calId);}
                 else {if (typeof cal.onNext!='undefined' && cal.onNext!=null) {cal.onNext();}
                       JACS.show(cal.ele,cal.id,cal.days);
                      }

                 if (cal.onBlurMoveNext)
                    {// if the target element has a tabIndex look for tabIndex+1
                     // if that exists then set the focus to it

                     var tagsToFind = 'INPUT;A;SELECT;TEXTAREA;BUTTON;AREA;OBJECT',
                         found      = false;

                     if (cal.ele.tabIndex>0)
                        {var tags = tagsToFind.split(';');

                         tagsOuterLoop:
                         for (var i=0;tags.length;i++)
                            {elementsByTag = document.getElementsByTagName(tags[i]);

                             for (var j=0;j<elementsByTag.length;j++)
                                {if (elementsByTag[j].tabIndex==(cal.ele.tabIndex+1) && !elementsByTag[j].disabled &&
                                     elementsByTag[j].type!='hidden' && elementsByTag[j].style.display!='none' &&
                                     elementsByTag[j].style.visibility!='hidden')
                                    {elementsByTag[j].focus();
                                     found = true;
                                     break tagsOuterLoop;
                                    }
                                }
                            }
                        }

                     // else do the full search to find the next element

                     if (!found)
                        {// find element tabIndices
                         function orderElements()
                            {var tabOrder  = new Array,
                                 unordered = new Array;

                             function elementArrays(ele)
                                {for (var i=0;i<ele.childNodes.length;i++)
                                    {var tempEle = ele.childNodes[i];
                                     if (tempEle.nodeType==1 && tempEle.style.display!='none' &&
                                         !tempEle.disabled   && tempEle.type!='hidden' &&
                                         tempEle.style.visibility!='hidden')
                                        {if (tagsToFind.indexOf(tempEle.tagName)>-1)
                                            {if (tempEle.tabIndex>0) {tabOrder[tempEle.tabIndex]  = tempEle}
                                             else                    {unordered[unordered.length] = tempEle}
                                            }
                                         elementArrays(tempEle);
                                        }
                                    }
                                };

                             elementArrays(document.body);

                             while (tabOrder.length>0 && tabOrder[0]==null) {tabOrder.shift();}

                             return tabOrder.concat(unordered);
                            };

                         var tabSequenced = orderElements();

                         // find the current element in tabIndex ordered array
                         // and set focus to the next element (or the first if
                         // the current is the last)

                         for (var i=0;i<tabSequenced.length;i++)
                            {if (tabSequenced[i]==cal.targetEle)
                                {if (i<(tabSequenced.length-1)) {tabSequenced[i+1].focus()}
                                 else                           {tabSequenced[0].focus()}
                                 break;
                                }
                            }
                        }
                    }
                 else
                    {if (!cal.targetEle.disabled      && cal.targetEle.style.display!='none' &&
                         cal.targetEle.type!='hidden' && cal.targetEle.style.visibility!='hidden')
                        {cal.targetEle.focus();}
                    }
                };

             function changeClass(evt)
                {var ele = eventTrigger(evt);

                 if (ele.nodeType==3) {ele=ele.parentNode;}

                 if (((evt)?evt.type:event.type)=='mouseover')
                    {switch (ele.className)
                        {case 'jacsCells':
                            ele.className = 'jacsCellsHover';        break;
                         case 'jacsCellsHighlighted':
                            ele.className = 'jacsCellsHighlightedHover';        break;
                         case 'jacsCellsExMonth':
                            ele.className = 'jacsCellsExMonthHover'; break;
                         case 'jacsCellsWeekend':
                            ele.className = 'jacsCellsWeekendHover'; break;
                         case 'jacsCellsHighlightedWeekend':
                            ele.className = 'jacsCellsHighlightedWeekendHover'; break;
                         case 'jacsNow':
                            ele.className = 'jacsNowHover';         break;
                         case 'jacsInputDate':
                            ele.className = 'jacsInputDateHover';
                        }
                    }
                 else
                    {switch (ele.className)
                        {case 'jacsCellsHover':
                            ele.className = 'jacsCells';             break;
                         case 'jacsCellsHighlightedHover':
                            ele.className = 'jacsCellsHighlighted';  break;
                         case 'jacsCellsExMonthHover':
                            ele.className = 'jacsCellsExMonth';      break;
                         case 'jacsCellsWeekendHover':
                            ele.className = 'jacsCellsWeekend';      break;
                         case 'jacsCellsHighlightedWeekendHover':
                            ele.className = 'jacsCellsHighlightedWeekend';      break;
                         case 'jacsNowHover':
                            ele.className = 'jacsNow';              break;
                         case 'jacsInputDateHover':
                            ele.className = 'jacsInputDate';
                        }
                    }
                 return true;
                };

             function eventTrigger(evt)
                {if (!evt) {evt = event;}
                 return evt.target||evt.srcElement;
                };

             function weekNumber(inDate)
                {// The base day in the week of the input date
                 var inDateWeekBase = new Date(inDate);

                 inDateWeekBase.setDate(inDateWeekBase.getDate() - inDateWeekBase.getDay() + cal.weekNumberBaseDay +
                                            ((inDate.getDay() > cal.weekNumberBaseDay)?7:0));

                 // The first Base Day in the year
                 var firstBaseDay = new Date(inDateWeekBase.getFullYear(),0,1);

                 firstBaseDay.setDate(firstBaseDay.getDate() - firstBaseDay.getDay() + cal.weekNumberBaseDay);

                 if (firstBaseDay<new Date(inDateWeekBase.getFullYear(),0,1))
                    {firstBaseDay.setDate(firstBaseDay.getDate()+7);}

                 // Start of Week 01
                 var startWeekOne = new Date(firstBaseDay - cal.weekNumberBaseDay + inDate.getDay());

                 if (startWeekOne>firstBaseDay) {startWeekOne.setDate(startWeekOne.getDate()-7);}

                 // Subtract the date of the current week from the date of the first week of the year to
                 // get the number of weeks in milliseconds.  Divide by the number of milliseconds in a
                 // week then round to no decimals in order to remove the effect of daylight saving.  Add
                 // one to make the first week, week 1.  Place a string zero on the front so that week
                 // numbers are zero filled.

                 var weekNo = '0'+(Math.round((inDateWeekBase - firstBaseDay)/604800000,0)+1);

                 // Return the last two characters in the week number string

                 return weekNo.substring(weekNo.length-2,weekNo.length);
                };

             // walk the DOM to display the dates.

             var cells = getEl(calId+'Cells').childNodes;

             for (var i=0;i<cells.length;i++)
                {var rows = cells[i];
                 if (rows.nodeType==1 && rows.tagName=='TR')
                    {tmpEl = rows.childNodes[0];
                     if (cal.weekNumberDisplay)
                          {//Calculate the week number using showDate
                           tmpEl.innerHTML = weekNumber(showDate);
                           tmpEl.style.borderColor =
                               (tmpEl.currentStyle)
                                    ?tmpEl.currentStyle['backgroundColor']
                                    :(document.defaultView.getComputedStyle)
                                        ?document.defaultView.getComputedStyle(tmpEl,null).backgroundColor
                                        :'';
                           tmpEl.style.display = '';
                          }
                     else  {tmpEl.style.display='none';}

                     for (var j=1;j<rows.childNodes.length;j++)
                        {var cols = rows.childNodes[j];
                         if (cols.nodeType==1 && cols.tagName=='TD')
                            {rows.childNodes[j].innerHTML = showDate.getDate();

                             var cell = rows.childNodes[j];

                             cell.style.visibility = (cal.outOfMonthHide &&
                                                      (showDate < (new Date(showDate.getFullYear(),curMonth,1,showDate.getHours())) ||
                                                       showDate > (new Date(showDate.getFullYear(),curMonth+1,0,showDate.getHours()))
                                                      )
                                                     )?'hidden':'inherit';

                             // Disable if the outOfRangeDisable option has been set and the current date
                             // is out of range or the cal.valuesEnabled option is true.
                             var disabled = cal.valuesEnabled;

                             if ((cal.outOfRangeDisable && (showDate < (new Date(cal.baseYear,0,1,12)) ||
                                                            showDate > (new Date(cal.baseYear+cal.dropDownYears,0,0,12))
                                                           )
                                 ) ||
                                 (cal.outOfMonthDisable && (showDate < (new Date(showDate.getFullYear(),curMonth,1,showDate.getHours())) ||
                                                            showDate > (new Date(showDate.getFullYear(),curMonth+1,0,showDate.getHours()))
                                                           )
                                 )
                                ) {disabled = true;}
                             else
                                {if ((cal.days.join().search(((j-1+(7*(i*cells.length/6))+cal.weekStart)%7))>-1) ||
                                      !cal.dayCells[j-1+(7*((i*cells.length)/6))]
                                    )   {disabled = !cal.valuesEnabled;} // Set (Disable or Enable) if the day is passed as a parameter of JACS.show
                                 else   {for (var k=0;k<cal.dates.length;k++)
                                            {if (typeof cal.dates[k]=='object' &&
                                                 ((cal.dates[k].constructor==Date  && compareDateValue == cal.dates[k].valueOf()) ||
                                                  (cal.dates[k].constructor==Array && compareDateValue >= cal.dates[k][0].valueOf() &&
                                                                                      compareDateValue <= cal.dates[k][1].valueOf()
                                                  )
                                                 )
                                                )
                                                {disabled = !cal.valuesEnabled;
                                                 break;
                                                }
                                            }
                                        }
                                }

                             if (disabled)
                                {rows.childNodes[j].onclick = null;

                                 if (getEl('jacsIE'))
                                    {rows.childNodes[j].onmouseover = null;
                                     rows.childNodes[j].onmouseout  = null;
                                    }

                                 cell.className=
                                    (showDate.getMonth()!=curMonth)
                                        ?'jacsCellsExMonthDisabled'
                                        :(cal.fullInputDate &&
                                          compareDateValue==
                                          cal.seedDate.valueOf())
                                            ?'jacsInputDateDisabled'
                                            :(showDate.getDay()%6==0)
                                                ?'jacsCellsWeekendDisabled'
                                                :'jacsCellsDisabled';

                                 cell.style.borderColor =
                                     (cal.formatTodayCell && showDate.toDateString()==dateNow.toDateString())
                                        ?cal.todayCellBorderColour
                                        :(cell.currentStyle)
                                            ?cell.currentStyle['backgroundColor']
                                            :(document.defaultView.getComputedStyle)
                                                ?document.defaultView.getComputedStyle(cell,null).backgroundColor
                                                :'';
                                }
                             else
                                {function cellOutput(evt)
                                    {var ele = eventTrigger(evt),
                                         outputDate = new Date(startDate);

                                     if (ele.nodeType==3) ele=ele.parentNode;

                                     outputDate.setDate(startDate.getDate() +
                                        parseInt(ele.id.substr(calId.length+5),10));

                                     setOutput(outputDate,calId);
                                    };

                                 if (cal.active)
                                    {rows.childNodes[j].onclick=cellOutput;}

                                 if (getEl('jacsIE'))
                                    {rows.childNodes[j].onmouseover = changeClass;
                                     rows.childNodes[j].onmouseout  = changeClass;
                                    }

                                 var highlighted = false;

                                 for (var k=0;k<cal.highlightDates.length;k++)
                                    {if (typeof cal.highlightDates[k]=='object' &&
                                         ((cal.highlightDates[k].constructor==Date  &&
                                           compareDateValue == cal.highlightDates[k].valueOf()) ||
                                          (cal.highlightDates[k].constructor==Array &&
                                           compareDateValue >= cal.highlightDates[k][0].valueOf() &&
                                           compareDateValue <= cal.highlightDates[k][1].valueOf()
                                          )
                                         )
                                        )
                                        {highlighted = true;
                                         break;
                                        }
                                    }

                                 cell.className=
                                     (showDate.getMonth()!=curMonth)
                                        ?'jacsCellsExMonth'
                                        :(cal.fullInputDate &&
                                          compareDateValue==
                                          cal.seedDate.valueOf())
                                            ?'jacsInputDate'
                                            :(showDate.getDay()%6==0)
                                                ?(highlighted)?'jacsCellsHighlightedWeekend':'jacsCellsWeekend'
                                                :(highlighted)?'jacsCellsHighlighted':'jacsCells';

                                 cell.style.borderColor =
                                     (cal.formatTodayCell && showDate.toDateString()==dateNow.toDateString())
                                        ?cal.todayCellBorderColour
                                        :(cell.currentStyle)
                                            ?cell.currentStyle['backgroundColor']
                                            :(document.defaultView.getComputedStyle)
                                                ?document.defaultView.getComputedStyle(cell,null).backgroundColor
                                                :'';
                               }

                             showDate.setDate(showDate.getDate()+1);
                             compareDateValue = new Date(showDate.getFullYear(),
                                                         showDate.getMonth(),
                                                         showDate.getDate()).valueOf();
                            }
                        }
                    }
                }
            }

         // Opera has a bug with setting the selected index.
         // It requires the following work-around to force SELECTs to display correctly.
         // Also Opera's poor dynamic rendering prior to 9.5 requires
         // the visibility to be reset to prevent garbage in the calendar
         // when the displayed month is changed.
         if (window.opera)
            {selMonths.style.display = 'inline';
              selYears.style.display = 'inline';
             cal.style.visibility = 'hidden';
             cal.style.visibility = 'inherit';
            }
        };

     function hide(instanceID)
        {if (typeof instanceID=='object')
                {for (var i=0;i<cals.length;i++) {hideOne(cals[i]);}}
         else   {hideOne(instanceID);}

         function hideOne(id)
            {cal = getEl(id);

             if (cal.dynamic)
                {cal.style.visibility = 'hidden';
                 getEl(id+'Iframe').style.visibility='hidden';
                 doNext(cal);
                }
            };
        };

     function doNext(cal)
        {if (cal.arrOnNext)
            {if (cal.arrOnNext.length > 0)
                 {cal.onNext = cal.arrOnNext.shift();
                  cal.onNext();
                  // Explicit null set to prevent closure causing memory leak
                  cal.onNext = null;
                 }
            }
        };

     function stopPropagation(evt)
       {if (evt.stopPropagation)
             {if (evt.target!=evt.currentTarget) {evt.stopPropagation(); evt.preventDefault();}}
        else {evt.cancelBubble = true;}
       };

     function toDate(d)
     {
         if(typeof d=='object')
         {
             return d;
         }
         var l=/[\-\/]/,n=/(\d{4})(\d{2})(\d{2})/;
         var a=l.test(d)?d.split(l):d.match(n).slice(1);
         return new Date(a[0],Number(a[1])-1,a[2]);
     };

// *********************************
//   End of Private Function Library
// *********************************
// Start of Public  Function Library
// *********************************

     return {show: function(ele)
                {// Check the type of any additional parameters.
                 // The optional string parameter is a calendar ID,
                 // Take any remaining parameters as day numbers to be handled
                 // (enabled/disabled) according to the setting of the
                 // calendar's  valuesEnabled  attribute.
                 // 0 = Sunday through to 6 = Saturday.

                 if (typeof arguments[1]=='object')
                    {var dynamic = true;

                     if (typeof arguments[2]=='string')
                            {var calId = arguments[2], min = 3;}
                     else   {var calId = 'jacs',       min = 2;}

                     // Stop the click event that opens the calendar
                     // from bubbling up to the document-level event
                     // handler that hides it!

                     var source = arguments[1];
                     if (!source) {source = window.event;}

                     if (source.tagName)    // Second parameter isn't an event it's an element
                        {var sourceEle = source;
                         if (getEl('jacsIE'))  {window.event.cancelBubble = true;}
                         else {sourceEle.parentNode.addEventListener('click',stopPropagation,false);}
                        }
                     else   // Second parameter is an event
                        {var event = source;
                         // Stop the click event that opens the calendar from bubbling up to
                         // the document-level event handler that hides it!
                         var sourceEle = (event.target)?event.target:event.srcElement;
                         if (event.stopPropagation) {event.stopPropagation();}
                         else                       {event.cancelBubble = true;}
                        }
                    }
                 else
                    {var sourceEle = ele, dynamic = false;

                     if (typeof arguments[1]=='string')
                            {var calId = arguments[1], min = 2;}
                     else   {var calId = 'jacs',       min = 1;}
                    }

                 // Add event handlers to the return element and its parent.
                 // This helps the script to support tab sequences and focus events.

                 if (document.addEventListener)
                        {ele.addEventListener('keydown',hideOnTab,false);
                         ele.parentNode.addEventListener('click',stopPropagation,false);}
                 else   {ele.attachEvent('onkeydown',hideOnTab);
                         if (ele.parentNode!=document.body)
                            {ele.parentNode.attachEvent('onclick',stopPropagation);}
                        }

                 function hideOnTab(evt)
                    {if (!evt) {var evt = window.event;}
                     if ((evt.keyCode||evt.which)==9) {hide(calId);}
                    };

                 // Create the calendar structure. One is enough unless you want more
                 // than one calendar visible on the page at one time.  If you DO need
                 // more, you can create as many as you like but each must have a unique
                 // ID.

                 // The first parameter of JACS.make is the ID of the calendar. The
                 // second is a boolean that determines whether the calendar is to be
                 // static on the page (assigned to a single input field and always
                 // visible) or dynamic (shown and hidden on events and can be assigned
                 // to any number of input fields).

                 //if (!getEl(calId)) {JACS.make(calId,dynamic);}
                 var tmpCal = getEl(calId); // modify by c
                 var tmpIframe = getEl(calId+"Iframe");
                 if (tmpCal&&tmpIframe){tmpCal.parentNode.removeChild(tmpCal);tmpIframe.parentNode.removeChild(tmpIframe);}
                 JACS.make(calId,dynamic);

                 cal = getEl(calId);

                 // If the calendar has been triggered using an onfocus event,
                 // and the script actively returns the focus to the target
                 // element (i.e. when cal.onBlurMoveNext = false). We need
                 // to kill the event.

                 if (event)
                    {if (event.type == 'focus' && cal.dateReturned && !cal.onBlurMoveNext && cal.prevEventType == 'focus')
                        {stopPropagation(event); cal.prevEventType = ''; cal.dateReturned = false; return false;}
                     cal.prevEventType = event.type;
                    }

                 if (cal.style.visibility != 'hidden' &&
                     cal.style.visibility != 'inherit' &&
                     typeof doNext == 'function') {doNext(cal);}

                 cal.triggerEle = sourceEle;

                 cal.dateReturned = false;
                 cal.activeToday  = true;

                 // Set enabled/disabled days

                 if (arguments.length==min) {cal.days.length=0;}
                 else {selectedDays = (typeof arguments[min]=='object')?arguments[min]:arguments;
                       for (var i=(min|0);i<selectedDays.length;i++)
                         {if (cal.days.join().indexOf(selectedDays[i])==-1) {cal.days.push(selectedDays[i]);}}
                      }

                 for (var i=0;i<cal.days.length;i++)
                    {if (dateNow.getDay()==cal.days[i]%7) {cal.activeToday = false; break;}}

                 //   If no value is preset then the seed date is
                 //      Today (when today is in range) OR
                 //      The middle of the date range.

                 cal.seedDate = dateNow;

                 // Find the date and Strip space characters from start and
                 // end of date input.

                 var dateValue = '';

                 if (ele.value) {dateValue = ele.value.replace(/^\s+/,'').replace(/\s+$/,'');}
                 else   {if (typeof ele.value == 'undefined')
                            {var childNodes = ele.childNodes;
                             for (var i=0;i<childNodes.length;i++)
                                {if (childNodes[i].nodeType == 3)
                                    {dateValue = childNodes[i].nodeValue.replace(/^\s+/,'').replace(/\s+$/,'');
                                     if (dateValue.length > 0)
                                        {cal.triggerEle.textNode = childNodes[i];
                                         cal.triggerEle.len      = childNodes[i].nodeValue.length;
                                         break;
                                        }
                                    }
                                }
                            }
                        }

                 // Set the year range

                 var yearOptions = getEl(calId+'Years').options;

                 if (yearOptions.length==0 || yearOptions[0].value!=cal.baseYear)
                    {yearOptions.length = 0;
                     for (var i=0;i<cal.dropDownYears;i++) {yearOptions[i] = new Option((cal.baseYear+i),(cal.baseYear+i));}
                    }

                 if (dateValue.length==0)
                    {// If no value is entered and today is within the range,
                     // use today's date, otherwise use the middle of the valid range.

                     cal.fullInputDate=false;

                     if ((new Date(cal.baseYear+cal.dropDownYears,0,0))<cal.seedDate ||
                         (new Date(cal.baseYear,0,1))                  >cal.seedDate
                        )
                        {cal.seedDate = new Date(cal.baseYear+Math.floor(cal.dropDownYears / 2), 5, 1);}
                    }
                 else
                    {function inputFormat()
                        {var seed = new Array(),
                             input = dateValue.split(new RegExp('[\\'+cal.delimiters.join('\\')+']+','g'));

                         // "Escape" all the user defined date delimiters above -
                         // several delimiters will need it and it does no harm for
                         // the others.

                         // Strip any empty array elements (caused by delimiters)
                         // from the beginning or end of the array. They will
                         // still appear in the output string if in the output
                         // format.

                         if (input[0]!=null)
                            {if (input[0].length==0)              {input.splice(0,1);}
                             if (input[input.length-1].length==0) {input.splice(input.length-1,1);}
                            }

                         cal.fullInputDate = false;

                         cal.dateFormat = cal.dateFormat.toUpperCase();

                         // List all the allowed letters in the date format
                         var template = ['D','M','Y'];

                         // Prepare the sequence of date input elements
                         var result = new Array();

                         for (var i=0;i<template.length;i++)
                            {if (cal.dateFormat.search(template[i])>-1)
                                {result[cal.dateFormat.search(template[i])] = template[i];}
                            }

                         cal.dateSequence = result.join('');

                         // Separate the elements of the date input
                         switch (input.length)
                            {case 1:
                                {// Year only entry or undelimited date format

                                 if (cal.dateFormat.indexOf('Y')>-1 &&
                                     input[0].length>cal.dateFormat.lastIndexOf('Y'))
                                    {seed[0] = parseInt(input[0].substring(cal.dateFormat.indexOf('Y'),
                                                                           cal.dateFormat.lastIndexOf('Y')+1),10);
                                    }
                                 else   {seed[0] = parseInt(input[0],10);}

                                 if (cal.dateFormat.indexOf('M')>-1 &&
                                     input[0].length>cal.dateFormat.lastIndexOf('M'))
                                    {seed[1] = input[0].substring(cal.dateFormat.indexOf('M'),
                                                                  cal.dateFormat.lastIndexOf('M')+1);
                                    }
                                 else   {seed[1] = cal.defaultToCurrentMonth?(dateNow.getMonth()+1).toString():'6';}

                                 if (cal.dateFormat.indexOf('D')>-1 &&
                                     input[0].length>cal.dateFormat.lastIndexOf('D'))
                                    {seed[2] = parseInt(input[0].substring(cal.dateFormat.indexOf('D'),
                                                                           cal.dateFormat.lastIndexOf('D')+1),10);
                                    }
                                 else   {seed[2] = 1;}

                                 if (input[0].length==cal.dateFormat.length)    {cal.fullInputDate = true;}
                                 break;
                                }
                             case 2:
                                {// Year and Month entry
                                 seed[0] = parseInt(input[cal.dateSequence.replace(/D/i,'').search(/Y/i)],10);  // Year
                                 seed[1] = input[cal.dateSequence.replace(/D/i,'').search(/M/i)];               // Month
                                 seed[2] = 1;                                                                        // Day
                                 break;
                                }
                             case 3:
                                {// Day Month and Year entry
                                 seed[0] = parseInt(input[cal.dateSequence.search(/Y/i)],10);  // Year
                                 seed[1] = input[cal.dateSequence.search(/M/i)];               // Month
                                 seed[2] = parseInt(input[cal.dateSequence.search(/D/i)],10);  // Day
                                 cal.fullInputDate = true;
                                 break;
                                }
                             default:
                                {// A stuff-up has led to more than three elements in the date.
                                 seed[0] = 0;     // Year
                                 seed[1] = 0;     // Month
                                 seed[2] = 0;     // Day
                                }
                            }

                         // These regular expressions validate the input date format
                         // to the following rules;
                         //         Day   1-31 (optional zero on single digits)
                         //         Month 1-12 (optional zero on single digits)
                         //                     or case insensitive name
                         //         Year  One, Two or four digits

                         // Months names are as set in the language-dependent
                         // definitions and delimiters are set just below there

                         var expValDay    = new RegExp('^(0?[1-9]|[1-2][0-9]|3[0-1])$'),
                             expValMonth  = new RegExp('^(0?[1-9]|1[0-2]|'+cal.monthNames.join('|')+')$','i'),
                             expValYear   = new RegExp('^([0-9]{1,2}|[0-9]{4})$');

                         // Apply validation and report failures

                         if (expValYear.exec(seed[0]) ==null ||
                             expValMonth.exec(seed[1])==null ||
                             expValDay.exec(seed[2])  ==null
                            )
                            {if (cal.showInvalidDateMsg)
                                {alert(cal.invalidDateMsg + cal.invalidAlert[0] + dateValue + cal.invalidAlert[1]);}
                             seed[0] = cal.baseYear + Math.floor(cal.dropDownYears/2);                   // Year
                             seed[1] = cal.defaultToCurrentMonth?(dateNow.getMonth()+1).toString():'6';  // Month
                             seed[2] = 1;                                                                // Day
                             cal.fullInputDate = false;
                            }

                         // Return the Year  in seed[0]
                         //            Month in seed[1]
                         //            Day   in seed[2]

                         return seed;
                        };

                     // Parse the string into an array using the allowed delimiters

                     seedDate = inputFormat();

                     // So now we have the Year, Month and Day in an array.

                     //   If the year is one or two digits then the routine assumes a
                     //   year belongs in the 21st Century unless it is less than 50
                     //   in which case it assumes the 20th Century is intended.

                     if (seedDate[0]<100) {seedDate[0] += (seedDate[0]>50)?1900:2000;}

                     // Check whether the month is in digits or an abbreviation

                     if (seedDate[1].search(/\d+/)<0)
                        {for (i=0;i<cal.monthNames.length;i++)
                            {if (seedDate[1].toUpperCase()==cal.monthNames[i].toUpperCase())
                                {seedDate[1]=i+1;
                                 break;
                                }
                            }
                        }

                     cal.seedDate = new Date(seedDate[0],seedDate[1]-1,seedDate[2]);
                    }

                 // Test that we have arrived at a valid date

                 if (isNaN(cal.seedDate))
                    {if (cal.showInvalidDateMsg)
                        {alert(cal.invalidDateMsg + cal.invalidAlert[0] + dateValue + cal.invalidAlert[1]);}
                     cal.seedDate = new Date(cal.baseYear + Math.floor(cal.dropDownYears/2),5,1);
                     cal.fullInputDate = false;
                    }
                 else
                    {// Test that the date is within range,
                     // if not then set date to a sensible date in range.

                     if ((new Date(cal.baseYear,0,1))>cal.seedDate)
                        {if (cal.strict && cal.showOutOfRangeMsg) {alert(cal.outOfRangeMsg);}
                         cal.seedDate = new Date(cal.baseYear,0,1);
                         cal.fullInputDate=false;
                        }
                     else
                        {if ((new Date(cal.baseYear+cal.dropDownYears,0,0))<cal.seedDate)
                            {if (cal.strict && cal.showOutOfRangeMsg) {alert(cal.outOfRangeMsg);}
                             cal.seedDate = new Date(cal.baseYear + Math.floor(cal.dropDownYears),-1,1);
                             cal.fullInputDate=false;
                            }
                         else
                            {if (cal.strict && cal.fullInputDate &&
                                  (cal.seedDate.getDate()     !=seedDate[2] ||
                                   (cal.seedDate.getMonth()+1)!=seedDate[1] ||
                                   cal.seedDate.getFullYear() !=seedDate[0]
                                  )
                                )
                                {if (cal.showDoesNotExistMsg) {alert(cal.doesNotExistMsg);}
                                 cal.seedDate = new Date(cal.seedDate.getFullYear(),cal.seedDate.getMonth()-1,1);
                                 cal.fullInputDate=false;
                                }
                            }
                        }
                    }

                 // Test the chosen dates for validity
                 // Give error message if not valid

                 for (var i=0;i<cal.dates.length;i++)
                    {if (!((typeof cal.dates[i]=='object') && (cal.dates[i].constructor==Date)))
                        {if ((typeof cal.dates[i]=='object') && (cal.dates[i].constructor==Array))
                            {var pass = true;

                             if (cal.dates[i].length!=2)
                                {if (cal.showRangeSettingError)
                                    {alert(cal.rangeSettingError[0] + cal.dates[i] + cal.rangeSettingError[1]);}
                                 pass = false;
                                }
                             else
                                {for (var j=0;j<cal.dates[i].length;j++)
                                    if (!((typeof cal.dates[i][j]=='object') && (cal.dates[i][j].constructor==Date)))
                                        {if (cal.showRangeSettingError)
                                            {alert(cal.dateSettingError[0] + cal.dates[i][j] + cal.dateSettingError[1]);}
                                         pass = false;
                                        }
                                }

                             if (pass && (cal.dates[i][0]>cal.dates[i][1])) {cal.dates[i].reverse();}
                            }
                         else
                            {if (cal.showRangeSettingError)
                                {alert(cal.dateSettingError[0] + cal.dates[i] + cal.dateSettingError[1]);}
                            }
                        }
                    }

                 // Set language-dependent values

                 getEl(calId+'DragText').innerHTML = cal.drag;

                 var monthOptions = getEl(calId+'Months').options,  months = '';

                 if (monthOptions.length>0) {for (var i=0;i<monthOptions.length;i++) {months += monthOptions[i].value+',';}}

                 if (monthOptions.length==0 || (cal.monthNames.join()+',')!=months)
                    {monthOptions.length = 0;

                     if (cal.monthNames.length<monthOptions.length) {monthOptions.length = cal.monthNames.length;}

                     for (var i=0;i<cal.monthNames.length;i++)
                        {if (i>monthOptions.length-1)
                              {monthOptions[i] = new Option(cal.monthNames[i],cal.monthNames[i]);}
                         else {monthOptions[i].innerHTML = cal.monthNames[i];}
                        }
                    }

                 for (var i=0;i<cal.weekInits.length;i++)
                    {getEl(calId+'WeekInit'+i).innerHTML = cal.weekInits[(i+cal.weekStart)%cal.weekInits.length];}

                 if (((new Date(cal.baseYear + cal.dropDownYears, 0, 0)) > dateNow &&
                      (new Date(cal.baseYear, 0, 0))                     < dateNow) ||
                     (cal.clearButton && (ele.readOnly || ele.disabled))
                    )   {getEl(calId+'Now').innerHTML = cal.today+' '+dateNow.jacsFormat(cal.dateDisplayFormat,cal.monthNames);
                         getEl(calId+'ClearButton').value   = cal.clear;
                         getEl(calId+'Foot').style.display = '';

                         if ((new Date(cal.baseYear + cal.dropDownYears, 0, 0)) > dateNow &&
                             (new Date(cal.baseYear, 0, 0))                     < dateNow)
                                {getEl(calId+'Now').style.display = '';
                                 if (cal.clearButton && (ele.readOnly || ele.disabled))
                                        {getEl(calId+'Clear').style.display   = '';
                                         getEl(calId+'Clear').style.textAlign = 'left';
                                         getEl(calId+'Now'  ).style.textAlign = 'right';
                                        }
                                 else   {getEl(calId+'Clear').style.display   = 'none';
                                         getEl(calId+'Now'  ).style.textAlign = 'center';
                                        }
                                }
                         else   {getEl(calId+'Clear').style.textAlign = 'center';
                                 getEl(calId+'Clear').style.display   = '';
                                 getEl(calId+'Now'  ).style.display   = 'none';
                                }
                        }
                 else   {getEl(calId+'Foot').style.display = 'none';}

                 // Calculate the number of months that the entered (or
                 // defaulted) month is after the start of the allowed
                 // date range.
                 cal.monthSum =  12*(cal.seedDate.getFullYear() - cal.baseYear) + cal.seedDate.getMonth();

                 // Set the drop down boxes.
                 getEl(calId+'Years').options.selectedIndex  = Math.floor(cal.monthSum/12);
                 getEl(calId+'Months').options.selectedIndex = (cal.monthSum%12);

                 getEl(calId).ele = ele;

                 // Display the month
                 showMonth(0,calId);

                 // Remember the Element
                 cal.targetEle = ele;

                 // Position the calendar box.
                 if (dynamic)
                    {// Check whether or not dragging is allowed and display drag handle if necessary
                     getEl(calId+'Drag').style.display = (cal.allowDrag)?'':'none';

                     var offsetTop  = parseInt(ele.offsetTop ,10),
                         offsetLeft = parseInt(ele.offsetLeft,10);

                     // The object sniffing for Opera allows for the fact that Opera
                     // is the only major browser that correctly reports the position
                     // of an element in a scrollable DIV.  This is because IE and
                     // Firefox omit the DIV from the offsetParent tree.
                     if (!window.opera)
                         {while (ele.tagName!='BODY' && ele.tagName!='HTML')
                             {offsetTop  -= parseInt(ele.scrollTop, 10);
                              offsetLeft -= parseInt(ele.scrollLeft,10);
                              ele = ele.parentNode;
                             }
                          ele = cal.targetEle;
                         }

                     while (ele.tagName!='BODY' && ele.tagName!='HTML')
                        {ele = ele.offsetParent;
                         offsetTop  += parseInt(ele.offsetTop, 10);
                         offsetLeft += parseInt(ele.offsetLeft,10);
                        }

                     ele = cal.targetEle;

                     var eleOffsetTop  = offsetTop,
                         eleOffsetLeft = offsetLeft;

                     if (cal.xBase.length>0)
                            {if (isNaN(cal.xBase))
                                    {cal.xBase = cal.xBase.toUpperCase();
                                     offsetLeft += (cal.xBase=='R')
                                                        ?parseInt(ele.offsetWidth,10)
                                                        :(cal.xBase=='M')?Math.round(parseInt(ele.offsetWidth,10)/2):0;
                                    }
                             else   {offsetLeft += parseInt(cal.xBase,10);}
                            }

                     if (cal.yBase.length>0)
                            {if (isNaN(cal.yBase))
                                    {cal.yBase  = cal.yBase.toUpperCase();
                                     offsetTop += (cal.yBase=='B')
                                                    ?parseInt(ele.offsetHeight,10)
                                                    :(cal.yBase=='M')?Math.round(parseInt(ele.offsetHeight,10)/2):0;
                                    }
                             else   {offsetTop += parseInt(cal.yBase,10);}
                            }
                     else   {offsetTop += parseInt(ele.offsetHeight,10);}

                     if (cal.xPosition.length>0)
                            {if (isNaN(cal.xPosition))
                                    {cal.xPosition = cal.xPosition.toUpperCase();
                                     offsetLeft -= (cal.xPosition=='R')
                                                        ?parseInt(cal.offsetWidth,10)
                                                        :(cal.xPosition=='M')?Math.round(parseInt(cal.offsetWidth,10)/2):0;
                                    }
                             else   {offsetLeft += parseInt(cal.xPosition,10);}
                            }

                     if (cal.yPosition.length>0)
                            {if (isNaN(cal.yPosition))
                                    {cal.yPosition = cal.yPosition.toUpperCase();

                                     offsetTop -= (cal.yPosition=='B')
                                                        ?parseInt(cal.offsetHeight,10)
                                                        :(cal.yPosition=='M')?Math.round((parseInt(cal.offsetHeight,10))/2):0;
                                    }
                             else   {offsetTop += parseInt(cal.yPosition,10);}
                            }

                     if (cal.autoPosition)
                        {var width      = parseInt(cal.offsetWidth, 10),
                             height     = parseInt(cal.offsetHeight,10),
                             windowLeft =
                                 (document.body && document.body.scrollLeft)
                                      ?document.body.scrollLeft                  //DOM compliant
                                      :(document.documentElement && document.documentElement.scrollLeft)
                                          ?document.documentElement.scrollLeft   //IE6+ standards compliant
                                          :0,                                    //Failed
                             windowWidth =
                                  (typeof(innerWidth) == 'number')
                                      ?innerWidth                                //DOM compliant
                                      :(document.documentElement && document.documentElement.clientWidth)
                                          ?document.documentElement.clientWidth  //IE6+ standards compliant
                                          :(document.body && document.body.clientWidth)
                                              ?document.body.clientWidth         //IE non-compliant
                                              :0,                                //Failed
                             windowTop =
                                  (document.body && document.body.scrollTop)
                                      ?document.body.scrollTop                   //DOM compliant
                                      :(document.documentElement && document.documentElement.scrollTop)
                                          ?document.documentElement.scrollTop    //IE6+ standards compliant
                                          :0,                                    //Failed
                             windowHeight =
                                  (typeof(innerHeight) == 'number')
                                      ?innerHeight                               //DOM compliant
                                      :(document.documentElement && document.documentElement.clientHeight)
                                          ?document.documentElement.clientHeight //IE6+ standards compliant
                                          :(document.body && document.body.clientHeight)
                                              ?document.body.clientHeight        //IE non-compliant
                                              :0;                                //Failed

                         if (eleOffsetLeft + parseInt(ele.offsetWidth,10) - width >= windowLeft &&
                             offsetLeft + width > windowLeft + windowWidth
                            )       {offsetLeft = eleOffsetLeft + parseInt(ele.offsetWidth,10) - width;}
                         else if (eleOffsetLeft >= windowLeft && offsetLeft < windowLeft
                                 )  {offsetLeft = eleOffsetLeft;}

                         if (eleOffsetTop - height >= windowTop &&
                             offsetTop + height > windowTop + windowHeight
                            )       {offsetTop = eleOffsetTop - height;}
                         else if (offsetTop + height <= windowTop + windowHeight && offsetTop < windowTop)
                                    {offsetTop = eleOffsetTop + parseInt(ele.offsetHeight,10);}
                        }

                     cal.style.top  = offsetTop+'px';
                     cal.style.left = offsetLeft+'px';

                     getEl(calId+'Iframe').style.top    = offsetTop +'px';
                     getEl(calId+'Iframe').style.left   = offsetLeft+'px';

                     getEl(calId+'Iframe').style.width  = (cal.offsetWidth -(getEl('jacsIE')?2:4))+'px';
                     getEl(calId+'Iframe').style.height = (cal.offsetHeight-(getEl('jacsIE')?2:4))+'px';
                     getEl(calId+'Iframe').style.visibility = 'inherit';
                    }

                 // Show it on the page
                 cal.style.visibility = 'inherit';
                },

             make: function (calId)
                {cals.push(calId);

                 var dynamic = (typeof arguments[1]=='boolean')?arguments[1]:true;

                 TABLEjacs           = document.createElement('table');
                 TABLEjacs.id        = calId;
                 TABLEjacs.dynamic   = dynamic;
                 TABLEjacs.className = (dynamic)?'jacs':'jacsStatic';

                 calAttributes(TABLEjacs);

                 if (dynamic) {TABLEjacs.style.zIndex = TABLEjacs.zIndex+1;}

                 function cancel(evt)
                    {if (TABLEjacs.clickToHide) {hide(calId);}
                     stopPropagation(evt);
                    };

                 TBODYjacs                 = document.createElement('tbody');
                 TRjacs1                   = document.createElement('tr');
                 TRjacs1.className         = 'jacs';
                 TDjacs1                   = document.createElement('td');
                 TDjacs1.className         = 'jacs';
                 TABLEjacsHead             = document.createElement('table');
                 TABLEjacsHead.id          = calId+'Head';
                 TABLEjacsHead.cellSpacing = '0';
                 TABLEjacsHead.cellPadding = '0';
                 TABLEjacsHead.className   = 'jacsHead';
                 TABLEjacsHead.width       = '100%';

                 TBODYjacsHead             = document.createElement('tbody');

                 TRjacsDrag                = document.createElement('tr');
                 TRjacsDrag.id             = calId+'Drag';
                 TRjacsDrag.style.display  = 'none';

                 TDjacsDrag                = document.createElement('td');
                 TDjacsDrag.className      = 'jacsDrag';
                 TDjacsDrag.colSpan        = '4';

                 function beginDrag(evt)
                    {var elToDrag = getEl(calId);

                     var deltaX    = evt.clientX,
                         deltaY    = evt.clientY,
                         offsetEle = elToDrag;

                     while (offsetEle.tagName!='BODY' && offsetEle.tagName!='HTML')
                        {deltaX   -= parseInt(offsetEle.offsetLeft,10);
                         deltaY   -= parseInt(offsetEle.offsetTop ,10);
                         offsetEle = offsetEle.offsetParent;
                        }

                     if (document.addEventListener)
                            {elToDrag.addEventListener('mousemove',moveHandler,true);
                             elToDrag.addEventListener('mouseup',    upHandler,true);
                            }
                     else   {elToDrag.attachEvent('onmousemove', moveHandler);
                             elToDrag.attachEvent('onmouseup',     upHandler);
                             elToDrag.setCapture();
                            }

                     stopPropagation(evt);

                     function moveHandler(evt)
                        {if (!evt) {evt = window.event;}

                         elToDrag.style.left = (evt.clientX-deltaX)+'px';
                         elToDrag.style.top  = (evt.clientY-deltaY)+'px';

                         getEl(calId+'Iframe').style.left = (evt.clientX-deltaX)+'px';
                         getEl(calId+'Iframe').style.top  = (evt.clientY-deltaY)+'px';

                         stopPropagation(evt);
                        };

                     function upHandler(evt)
                        {if (!evt) {evt = window.event;}

                         if (document.removeEventListener)
                                {elToDrag.removeEventListener('mousemove',moveHandler,true);
                                 elToDrag.removeEventListener(  'mouseup',  upHandler,true);
                                }
                         else   {elToDrag.detachEvent('onmouseup',    upHandler);
                                 elToDrag.detachEvent('onmousemove',moveHandler);
                                 elToDrag.releaseCapture();
                                }

                         stopPropagation(evt);
                        };
                    };

                 DIVjacsDragText           = document.createElement('span');
                 DIVjacsDragText.id        = calId+'DragText';

                 TRjacsHead                = document.createElement('tr');
                 TRjacsHead.className      = 'jacsHead';

                 TDjacsHead1               = document.createElement('td');
                 TDjacsHead1.className     = 'jacsHead';

                 INPUTjacsHead1            = document.createElement('input');
                 INPUTjacsHead1.className  = 'jacsHead';
                 INPUTjacsHead1.id         = calId+'HeadLeft';
                 INPUTjacsHead1.type       = 'button';
                 INPUTjacsHead1.tabIndex   = '-1';
                 INPUTjacsHead1.value      = '<';
                 INPUTjacsHead1.onclick    = function() {showMonth(-1,calId);}

                 TDjacsHead2               = document.createElement('td');
                 TDjacsHead2.className     = 'jacsHead';

                 SELECTjacsHead2           = document.createElement('select');
                 SELECTjacsHead2.className = 'jacsHead';
                 SELECTjacsHead2.id        = calId+'Months';
                 SELECTjacsHead2.tabIndex  = '-1';
                 SELECTjacsHead2.onchange  = function() {showMonth(0,calId);}

                 TDjacsHead3               = document.createElement('td');
                 TDjacsHead3.className     = 'jacsHead';

                 SELECTjacsHead3           = document.createElement('select');
                 SELECTjacsHead3.className = 'jacsHead';
                 SELECTjacsHead3.id        = calId+'Years';
                 SELECTjacsHead3.tabIndex  = '-1';
                 SELECTjacsHead3.onchange  = function() {showMonth(0,calId);}

                 TDjacsHead4               = document.createElement('td');
                 TDjacsHead4.className     = 'jacsHead';

                 INPUTjacsHead4            = document.createElement('input');
                 INPUTjacsHead4.className  = 'jacsHead';
                 INPUTjacsHead4.id         = calId+'HeadRight';
                 INPUTjacsHead4.type       = 'button';
                 INPUTjacsHead4.tabIndex   = '-1';
                 INPUTjacsHead4.value      = '>';
                 INPUTjacsHead4.onclick    = function() {showMonth(1,calId);}

                 TRjacs2                   = document.createElement('tr');
                 TRjacs2.className         = 'jacs';

                 TDjacs2                   = document.createElement('td');
                 TDjacs2.className         = 'jacs';

                 TABLEjacsCells            = document.createElement('table');
                 TABLEjacsCells.className  = 'jacsCells';
                 TABLEjacsCells.align      = 'center';
                 TABLEjacsCells.width      = '100%';

                 THEADjacsCells            = document.createElement('thead');
                 TRjacsCells               = document.createElement('tr');
                 TDjacsCells               = document.createElement('td');
                 TDjacsCells.className     = 'jacsWeekNumberHead';
                 TDjacsCells.id            = calId+'Week_';

                 TABLEjacs.appendChild(TBODYjacs);
                 TBODYjacs.appendChild(TRjacs1);
                    TRjacs1.appendChild(TDjacs1);
                        TDjacs1.appendChild(TABLEjacsHead);
                            TABLEjacsHead.appendChild(TBODYjacsHead);
                                 TBODYjacsHead.appendChild(TRjacsDrag);
                                    TRjacsDrag.appendChild(TDjacsDrag);
                                        TDjacsDrag.appendChild(DIVjacsDragText);
                                 TBODYjacsHead.appendChild(TRjacsHead);
                                    TRjacsHead.appendChild(TDjacsHead3);
                                        TDjacsHead3.appendChild(SELECTjacsHead3);
                                    TRjacsHead.appendChild(TDjacsHead1);
                                        TDjacsHead1.appendChild(INPUTjacsHead1);
                                    TRjacsHead.appendChild(TDjacsHead2);
                                        TDjacsHead2.appendChild(SELECTjacsHead2);
                                    TRjacsHead.appendChild(TDjacsHead4);
                                        TDjacsHead4.appendChild(INPUTjacsHead4);
                 TBODYjacs.appendChild(TRjacs2);
                    TRjacs2.appendChild(TDjacs2);
                        TDjacs2.appendChild(TABLEjacsCells);
                            TABLEjacsCells.appendChild(THEADjacsCells);
                                THEADjacsCells.appendChild(TRjacsCells);
                                    TRjacsCells.appendChild(TDjacsCells);

                                    for (var i=0;i<7;i++)
                                        {TDjacsCells           = document.createElement('td');
                                         TDjacsCells.className = 'jacsWeek';
                                         TDjacsCells.id        = calId+'WeekInit'+i;
                                         TRjacsCells.appendChild(TDjacsCells);
                                        }

                            TBODYjacsCells    = document.createElement('tbody');
                            TBODYjacsCells.id = calId+'Cells';

                            TABLEjacsCells.appendChild(TBODYjacsCells);

                            for (var i=0;i<6;i++)
                                {TRjacsCells              = document.createElement('tr');
                                 TBODYjacsCells.appendChild(TRjacsCells);

                                    TDjacsCells           = document.createElement('td');
                                    TDjacsCells.className = 'jacsWeekNo';
                                    TDjacsCells.id        = calId+'Week_'+i;
                                    TRjacsCells.appendChild(TDjacsCells);

                                    for (var j=0;j<7;j++)
                                        {TDjacsCells           = document.createElement('td');
                                         TDjacsCells.className = 'jacsCells';
                                         TDjacsCells.id        = calId+'Cell_'+(j+(i*7));
                                         TRjacsCells.appendChild(TDjacsCells);
                                        }
                                }

                 TFOOTjacsFoot           = document.createElement('tfoot');
                 TABLEjacsCells.appendChild(TFOOTjacsFoot);

                    TRjacsFoot              = document.createElement('tr');
                    TRjacsFoot.id           = calId+'Foot';
                    TFOOTjacsFoot.appendChild(TRjacsFoot);

                    TDjacsFoot               = document.createElement('td');
                    TDjacsFoot.colSpan       = '8';
                    TDjacsFoot.style.padding = '0px';
                    TRjacsFoot.appendChild(TDjacsFoot);

                        TABLEjacsFootDetail = document.createElement('table');
                        TABLEjacsFootDetail.style.width = '100%';
                        TABLEjacsFootDetail.cellSpacing = '0';
                        TABLEjacsFootDetail.cellPadding = '0';
                        TDjacsFoot.appendChild(TABLEjacsFootDetail);

                            TBODYjacsFootDetail = document.createElement('tbody');
                            TABLEjacsFootDetail.appendChild(TBODYjacsFootDetail);

                                TRjacsFootDetail = document.createElement('tr');
                                TBODYjacsFootDetail.appendChild(TRjacsFootDetail);

                                    TDjacsFootDetail           = document.createElement('td');
                                    TDjacsFootDetail.className = 'jacsClear';
                                    TDjacsFootDetail.id        = calId+'Clear';
                                    TDjacsFootDetail.style.padding = '0px';
                                    TRjacsFootDetail.appendChild(TDjacsFootDetail);

                                        INPUTjacsClearButton           = document.createElement('input');
                                        INPUTjacsClearButton.type      = 'button';
                                        INPUTjacsClearButton.id        = calId+'ClearButton';
                                        INPUTjacsClearButton.className = 'Clear';
                                        INPUTjacsClearButton.style.textAlign = 'center';
                                        INPUTjacsClearButton.onclick   = function() {cal.targetEle.value='';hide(calId);};
                                        TDjacsFootDetail.appendChild(INPUTjacsClearButton);

                                    TDjacsNow                 = document.createElement('td');
                                    TDjacsNow.className       = 'jacsNow';
                                    TDjacsNow.id              = calId+'Now';
                                    TDjacsNow.style.padding   = '0px';
                                    TRjacsFootDetail.appendChild(TDjacsNow);

                 if (TABLEjacs.clickToHide)
                    {if (document.addEventListener)
                            {      TABLEjacs.addEventListener('click',    cancel,         false);
                                   TABLEjacs.addEventListener('change',   cancel,         false);
                                  TDjacsDrag.addEventListener('mousedown',beginDrag,      false);
                              INPUTjacsHead1.addEventListener('click',    stopPropagation,false);
                             SELECTjacsHead2.addEventListener('click',    stopPropagation,false);
                             SELECTjacsHead2.addEventListener('change',   stopPropagation,false);
                             SELECTjacsHead3.addEventListener('click',    stopPropagation,false);
                             SELECTjacsHead3.addEventListener('change',   stopPropagation,false);
                              INPUTjacsHead4.addEventListener('click',    stopPropagation,false);
                              TBODYjacsCells.addEventListener('click',    stopPropagation,false);
                            }
                     else   {      TABLEjacs.attachEvent('onclick',    cancel);
                                   TABLEjacs.attachEvent('onchange',   cancel);
                                  TDjacsDrag.attachEvent('onmousedown',beginDrag);
                              INPUTjacsHead1.attachEvent('onclick',    stopPropagation);
                             SELECTjacsHead2.attachEvent('onclick',    stopPropagation);
                             SELECTjacsHead2.attachEvent('onchange',   stopPropagation);
                             SELECTjacsHead3.attachEvent('onclick',    stopPropagation);
                             SELECTjacsHead3.attachEvent('onchange',   stopPropagation);
                              INPUTjacsHead4.attachEvent('onclick',    stopPropagation);
                              TBODYjacsCells.attachEvent('onclick',    stopPropagation);
                            }
                    }
                 else
                    {if (document.addEventListener)
                        {      TABLEjacs.addEventListener('click',    stopPropagation,false);
                               TABLEjacs.addEventListener('change',   stopPropagation,false);
                              TDjacsDrag.addEventListener('mousedown',beginDrag,      false);
                        }
                     else
                        {      TABLEjacs.attachEvent('onclick',    stopPropagation);
                               TABLEjacs.attachEvent('onchange',   stopPropagation);
                              TDjacsDrag.attachEvent('onmousedown',beginDrag);
                        }
                    }
                 if (dynamic)
                        {iFrame = document.createElement('iframe');

                         iFrame.className    = 'jacs';
                         iFrame.id           = calId+'Iframe';
                         if (getEl('jacsIElt7')) {iFrame.src = '/jacsblank.html';}
                         iFrame.name         = 'jacsIframe';
                         iFrame.frameborder  = '0';
                         iFrame.style.zIndex = TABLEjacs.zIndex;

                         document.body.insertBefore(iFrame, document.body.firstChild);
                         document.body.insertBefore(TABLEjacs, iFrame);
                        }
                 else   {if (!getEl('jacsSpan'+calId)) {document.writeln("<span id='jacsSpan"+calId+"'></span>");}
                         getEl('jacsSpan'+calId).appendChild(TABLEjacs);
                        }
                },

             cals: function ()  {return cals;},
             next: function ()
                {if (typeof arguments[0]=='string')
                        {calID       = arguments[0];
                         inFunc      = arguments[1];
                         argPosition = 2;
                        }
                 else   {calID       = 'jacs';
                         inFunc      = arguments[0];
                         argPosition = 1;
                        }

                 if (getEl(calID))
                    {// Take the arguments to be passed through to the defined function.

                     var args = new Array();

                     for (var i=argPosition;i<arguments.length;i++) {args.push(arguments[i]);}

                     // Pass them through to jacsRunNext

                     newFunc = inFunc.jacsRunNext(args,calID);

                     // If the function has already been set, clear the old
                     // function and set the new one (mostly relevant for dynamic
                     // calendars but refreshing the function for static calendars
                     // caters for dynamic parameters).

                     var cal = getEl(calID);

                     if (cal.dynamic) {cal.arrOnNext.push(newFunc);}
                     else             {cal.onNext = newFunc;}
                    }
                 else
                    {alert('ERROR: Calendar object <<' + calID + '>> does not exist.\n' +
                           'Please check that the calendar object id is correct\n' +
                           'and that JACS.show is called before JACS.next.');
                    }
                },
                setDropYear: function(BaseYear,DropYear) {
                	_bYear = BaseYear;
                	_dYear = DropYear;
                },
                setXBase: function(XBase) {  //added by Lee
                	_xBase = XBase;
                },
                setDay: function(ForwardDay, BackwardDay) { // add by c
                	_fDay = ForwardDay;
                	_bDay = BackwardDay;
                },
                setHostDay: function(HostDate, BackwardDay)
                {
                	var now=new Date();
                	_fDay=(toDate(HostDate).getTime()-new Date(now.getFullYear(),now.getMonth(),now.getDate()).getTime())/86400000;
                	_bDay=BackwardDay;
                },
                disableDays: function(dList)
                {
                	for(var i=0;i<dList.length;_dList.push(toDate(dList[i++])));
                },
                clearDisableDays: function()
                {
                	_dList = [];
                }
            };
    };

// ******************************
// End of Public Function Library
// ******************************************************
// End of Javascript Advanced Calendar Script (JACS) Code
// ******************************************************        20190705221915                         |     |   | / *   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
           J a v a S c r i p t   A d v a n c e d   C a l e n d a r   S c r i p t   ( J A C S )   -   C r o s s - B r o w s e r   p o p - u p   c a l e n d a r . 
 
 
 
           C o p y r i g h t   ( C )   2 0 0 7 - 2 0 0 8     A n t h o n y   G a r r e t t 
 
 
 
           T h i s   l i b r a r y   i s   f r e e   s o f t w a r e ;   y o u   c a n   r e d i s t r i b u t e   i t   a n d / o r 
 
           m o d i f y   i t   u n d e r   t h e   t e r m s   o f   t h e   G N U   L e s s e r   G e n e r a l   P u b l i c 
 
           L i c e n s e   a s   p u b l i s h e d   b y   t h e   F r e e   S o f t w a r e   F o u n d a t i o n ;   e i t h e r 
 
           v e r s i o n   2 . 1   o f   t h e   L i c e n s e ,   o r   ( a t   y o u r   o p t i o n )   a n y   l a t e r   v e r s i o n . 
 
 
 
           T h i s   l i b r a r y   i s   d i s t r i b u t e d   i n   t h e   h o p e   t h a t   i t   w i l l   b e   u s e f u l , 
 
           b u t   W I T H O U T   A N Y   W A R R A N T Y ;   w i t h o u t   e v e n   t h e   i m p l i e d   w a r r a n t y   o f 
 
           M E R C H A N T A B I L I T Y   o r   F I T N E S S   F O R   A   P A R T I C U L A R   P U R P O S E .     S e e   t h e   G N U 
 
           L e s s e r   G e n e r a l   P u b l i c   L i c e n s e   f o r   m o r e   d e t a i l s . 
 
 
 
           Y o u   s h o u l d   h a v e   r e c e i v e d   a   c o p y   o f   t h e   G N U   L e s s e r   G e n e r a l   P u b l i c 
 
           L i c e n s e   a l o n g   w i t h   t h i s   l i b r a r y ;   i f   n o t ,   i t   i s   a v a i l a b l e   a t 
 
           t h e   G N U   w e b   s i t e   ( h t t p : / / w w w . g n u . o r g / )   o r   b y   w r i t i n g   t o   t h e 
 
           F r e e   S o f t w a r e   F o u n d a t i o n ,   I n c . ,   5 1   F r a n k l i n   S t ,   F i f t h   F l o o r , 
 
           B o s t o n ,   M A     0 2 1 1 0 - 1 3 0 1     U S A 
 
 
 
 * / / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 / * 
 
       C o n t a c t :       S o r r y ,   I   c a n ' t   o f f e r   s u p p o r t   f o r   t h i s   b u t   i f   y o u   f i n d   a   p r o b l e m 
 
                             ( o r   j u s t   w a n t   t o   t e l l   m e   h o w   u s e f u l   y o u   f i n d   i t ) ,   p l e a s e   s e n d 
 
                             m e   a n   e m a i l   a t   j a c s F e e d b a c k @ t a r r g e t . i n f o   ( N o t e   t h e   t w o   R s   i n 
 
                             t a r r g e t ) .     I   w i l l   t r y   t o   f i x   p r o b l e m s   q u i c k l y   b u t   t h i s   i s   a 
 
                             s p a r e   t i m e   t h i n g   f o r   m e . 
 
 
 
       C r e d i t s :       I   w r o t e   t h i s   b a s e d   o n   m y   S i m p l e   C a l e n d a r   W i d g e t   s c r i p t   w h i c h 
 
                             I   w r o t e   f r o m   s c r a t c h   m y s e l f   b u t   I   c o u l d n ' t   h a v e   d o n e   e i t h e r 
 
                             w i t h o u t   t h e   s u p e r b   " J a v a S c r i p t   T h e   D e f i n i t i v e   G u i d e "   b y   D a v i d 
 
                             F l a n a g a n   ( P u b .   O ' R e i l l y   I S B N   0 - 5 9 6 - 0 0 0 4 8 - 0 )   a n d   P e t e r - P a u l   K o c h ' s 
 
                             ( P P K )   b r i l l i a n t   Q u i r k s m o d e   s i t e . 
 
 
 
       L i n k   b a c k :   P l e a s e   g i v e   m e   c r e d i t   a n d   l i n k   b a c k   t o   m y   p a g e   i f   y o u   c a n .     T o 
 
                             e n s u r e   t h a t   s e a r c h   e n g i n e s   g i v e   m y   p a g e   a   h i g h e r   r a n k i n g   y o u   c a n 
 
                             a d d   t h e   f o l l o w i n g   H T M L   t o   a n y   i n d e x e d   p a g e   o n   y o u r   w e b   s i t e : 
 
 
 
                             < A   H R E F = " h t t p : / / w w w . t a r r g e t . i n f o / c a l e n d a r / j a c s . h t m " > 
 
                                 J a v a S c r i p t   A d v a n c e d   C a l e n d a r   S c r i p t   ( J A C S )   b y   A n t h o n y   G a r r e t t 
 
                             < / A > 
 
 
 
                             Y o u r   r o o t   d i r e c t o r y   o f   t h e   w e b   s i t e   s h o u l d   a l s o   c o n t a i n   a n   e m p t y 
 
                             f i l e   c a l l e d   " j a c s b l a n k . h t m l " .   F o r   a   f u l l   e x p l a n a t i o n   s e e 
 
                             h t t p : / / w w w . t a r r g e t . i n f o / c a l e n d a r / I E n i g h t m a r e . h t m l . 
 
 
 
       F e a t u r e s :     E a s i l y   c u s t o m i s e d   ( o u t p u t   d a t e   f o r m a t ,   c o l o u r s ,   l a n g u a g e , 
 
                                                                   y e a r   r a n g e   a n d   w e e k   s t a r t   d a y ) 
 
                             A c c e p t s   a   d a t e   a s   i n p u t   ( s e e   c o m m e n t s   b e l o w   f o r   f o r m a t s ) . 
 
                             A l l o w s   m u l t i p l e   c a l e n d a r s   o n   a   p a g e   a n d   s t a t i c   c a l e n d a r   d i s p l a y s . 
 
 
 
                             C r o s s - b r o w s e r   c o d e   t e s t e d   a g a i n s t ; 
 
                                         I n t e r n e t   E x p l o r e r   6 . 0 . 2 8 +         M o z i l l a     1 . 7 . 1 
 
                                         O p e r a                           7 . 5 2 +             F i r e f o x     0 . 9 . 1 + 
 
                                         K o n q u e r o r                   4 . 0 . 1             S a f a r i       3   ( B e t a   f o r   W i n d o w s ) 
 
 
 
       H o w   t o   a d d   t h e   C a l e n d a r   t o   y o u r   p a g e : 
 
                             T h i s   s c r i p t   n e e d s   t o   b e   d e f i n e d   f o r   y o u r   p a g e   s o   a d d   t h e   f o l l o w i n g 
 
                             l i n e ; 
 
                                         < s c r i p t   t y p e = ' t e x t / J a v a S c r i p t '   s r c = ' j a c s . j s ' > < / s c r i p t > 
 
 
 
       H o w   t o   u s e   t h e   C a l e n d a r   o n c e   i t   i s   d e f i n e d   f o r   y o u r   p a g e : 
 
 
 
                 D y n a m i c   c a l e n d a r : 
 
 
 
                             S i m p l y   c h o o s e   a n   e v e n t   t o   t r i g g e r   t h e   c a l e n d a r   ( l i k e   a n   o n c l i c k   o r   a n   o n m o u s e o v e r ) 
 
                             a n d   a n   e l e m e n t   t o   w o r k   o n   ( f o r   t h e   c a l e n d a r   t o   t a k e   i t s   i n i t i a l   d a t e   f r o m   a n d   w r i t e 
 
                             i t s   o u t p u t   d a t e   t o )   t h e n   w r i t e   i t   l i k e   t h i s ; 
 
 
 
                                         o n c l i c k = " J A C S . s h o w ( d o c u m e n t . g e t E l e m e n t B y I d ( ' m y E l e m e n t ' ) , e v e n t ) ; " 
 
                                 o r 
 
                                         o n f o c u s = " J A C S . s h o w ( t h i s , e v e n t ) ; " 
 
 
 
                             N O T E :   I f   y o u   w i s h   t o   u s e   t h e   c a l e n d a r   w i t h   a n   A n c h o r   t a g ,   d o   n o t   u s e   t h e 
 
                                         h r e f = " j a v a s c r i p t : J A C S . s h o w ( . . . ) "   s y n t a x . 
 
 
 
                                         I n s t e a d   y o u   s h o u l d   u s e   t h e   f o l l o w i n g ; 
 
 
 
                                         < a   h r e f = " # "   o n c l i c k = " J A C S . s h o w ( < < e l e m e n t > > , e v e n t ) ; r e t u r n   f a l s e ; " > 
 
                                                 < < y o u r   t e x t > > 
 
                                         < / a > 
 
 
 
                             I f   y o u   a r e   u s i n g   a   t e x t   n o d e   t h e n   s p e c i f y   t h e   t e x t ' s   p a r e n t   n o d e   i n   t h e 
 
                             f u n c t i o n   c a l l .   T h e   d a t e   s h o u l d   b e   t h e   o n l y   t e x t   u n d e r   t h a t   n o d e ; 
 
 
 
                                         < p   o n c l i c k = " J A C S . s h o w ( t h i s , e v e n t ) ; " > < < d a t e > > < / p > 
 
 
 
                 S t a t i c   c a l e n d a r : 
 
 
 
                                         J A C S . s h o w ( < < e l e m e n t > > < < , o p t i o n a l   c a l e n d a r   I D > > < < , o p t i o n a l   d i s a b l e d   d a y s > > ) ; 
 
 
 
                             A   s t a t i c   c a l e n d a r   a p p e a r s   o n   s c r e e n   w h e n   t h e   p a g e   l o a d s ,   c a n n o t   b e   d r a g g e d   a n d 
 
                             r e m a i n s   o n   s c r e e n   a f t e r   i t   h a s   b e e n   u s e d   t o   s e l e c t   a   d a t e .   I t   r e t u r n s   t h e   d a t e 
 
                             i n t o   t h e   v a l u e   o f   a   d e f i n e d   e l e m e n t   ( e . g .   a n   I N P U T   e l e m e n t )   b u t ,   o f   c o u r s e , 
 
                             t h a t   c a n   b e   h i d d e n . 
 
 
 
                 C a l e n d a r   w i t h   s e l e c t e d   d a y s : 
 
 
 
                             Y o u   c a n   s e l e c t   d a y s   o f   t h e   w e e k   b y   a d d i n g   a r g u m e n t s   t o   t h e 
 
                             c a l l   t o   J A C S . s h o w .   T h e s e   s e l e c t e d   d a y s   c a n   b e   t h e   o n l y   o n e s 
 
                             e n a b l e d   o r   t h e   o n l y   o n e s   d i s a b l e d   d e p e n d i n g   o n   t h e   s e t t i n g   o f 
 
                             t h e   a t t r i b u t e   v a l u e s E n a b l e d   ( s e e   b e l o w ) .   T h e   v a l u e s   s h o u l d   b e 
 
                             S u n d a y   =   0   t h r o u g h   t o   S a t u r d a y   =   6 .   T h e   p a r a m e t e r s   c a n   b e   a 
 
                             s e r i e s   o f   s i n g l e   v a l u e s   o r   a n   a r r a y   h o l d i n g   t h o s e   v a l u e s .   A   c a l l 
 
                             t o   J A C S . s h o w   w i t h   F r i d a y   a n d   M o n d a y   s e l e c t e d   c o u l d   l o o k   s o m e t h i n g 
 
                             l i k e   t h i s ; 
 
 
 
                                                 J A C S . s h o w ( < < e l e m e n t > > , e v e n t , 5 , 1 ) ; 
 
                             o r   t h i s ; 
 
                                                 v a r   m y A r r a y   =   [ 5 , 1 ] ; 
 
                                                 J A C S . s h o w ( < < e l e m e n t > > , e v e n t , m y A r r a y ) ; 
 
 
 
                 N a m e d   c a l e n d a r : 
 
 
 
                                         J A C S . s h o w ( < < e l e m e n t > > , e v e n t < < , c a l e n d a r   I D > > ) ; 
 
 
 
                             ' j a c s '   i s   t h e   d e f a u l t   I D   o f   t h e   c a l e n d a r   b u t   y o u   c a n   a s s i g n   a n y   I D 
 
                             y o u   w a n t .     Y o u   c a n   c a l l   o n e   n a m e   a s   m a n y   t i m e s   a s   y o u   l i k e , 
 
                             b u t   a s   i t   i s   o n e   o b j e c t ,   i t   c a n   o n l y   a p p e a r   o n   s c r e e n   i n   o n e   l o c a t i o n 
 
                             a t   a   t i m e .     I f   y o u   w a n t   m o r e   t h a n   t h a t   t h e n   y o u   m u s t   g i v e   d i f f e r e n t   I D s . 
 
 
 
                             [ N o t e :   i n   t h e   a b o v e   p a r a g r a p h   I   u s e   " n a m e "   a n d   " i d "   i n t e r c h a n g e a b l y ,   n o t 
 
                                           i n   t h e   s e n s e   o f   H T M L   t a g   a t t r i b u t e s   " n a m e "   a n d   " i d " .   ] 
 
 
 
                 N o   e v e n t ?   N o   p r o b l e m ! 
 
 
 
                             N o r m a l l y   t h e   c a l e n d a r   w i l l   b e   t r i g g e r e d   b y   a n   e v e n t   b u t   i f   y o u   w i s h   t o 
 
                             c o n t r o l   i t   i n   c o d e   a n d   t h e   e v e n t   i s   n o t   a v a i l a b l e   t o   y o u ,   s i m p l y   p a s s 
 
                             a n   e l e m e n t   a s   t h e   s e c o n d   p a r a m e t e r ; 
 
 
 
                             E . G .     J A C S . s h o w ( < < t a r g e t   e l e m e n t > > , < < s o u r c e   e l e m e n t > > ) ; 
 
                                         a s   i n :   J A C S . s h o w ( t h i s , t h i s ) ; 
 
 
 
                 C a l e n d a r   w i t h   p o s t - p r o c e s s i n g : 
 
 
 
                             T h e   f o l l o w i n g   t e c h n i q u e   r u n s   a   f u n c t i o n   e a c h   t i m e   a   d y n a m i c   c a l e n d a r 
 
                             c l o s e s   o r   a   d a t e   i s   s e l e c t e d   f r o m   a   s t a t i c   c a l e n d a r : 
 
 
 
                                         J A C S . s h o w ( < < D y n a m i c   o r   S t a t i c   c a l e n d a r   a r g u m e n t   l i s t > > ) ; 
 
                                         J A C S . n e x t ( < < o p t i o n a l   c a l e n d a r   I D , > > < < f u n c t i o n > > < < , a r g u m e n t s > > ) ; 
 
 
 
                             W h e r e   < < f u n c t i o n > >   i s   a   f u n c t i o n   d e f i n e d   o n   t h e   c a l l i n g   p a g e 
 
                             a n d   < < a r g u m e n t s > >   i s   t h e   l i s t   o f   a r g u m e n t s   b e i n g   p a s s e d   t o   t h a t 
 
                             f u n c t i o n . 
 
 
 
                             T h e   c a l e n d a r   I D   d e f a u l t s   t o   ' j a c s ' ,   i f   y o u   a r e   u s i n g   a   d i f f e r e n t 
 
                             c a l e n d a r   o b j e c t   ( S e e   c a l e n d a r   n a m i n g   a b o v e ) ,   y o u   m u s t   g i v e   i t s 
 
                             I D   a s   t h e   f i r s t   a r g u m e n t . 
 
 
 
                             N O T E S :   T h e s e   t w o   c a l l s   a r e   e x p e c t e d   i n   t h i s   o r d e r   ( i . e .   s h o w   b e f o r e 
 
                                           n e x t )   b e c a u s e   J A C S . n e x t   e x p e c t s   t h e   c a l e n d a r   o b j e c t   t o   e x i s t . 
 
 
 
                                           I f   J A C S . m a k e   h a s   n o t   b e e n   c a l l e d   f o r   t h e   o b j e c t   a n d   J A C S . s h o w 
 
                                           i s   c a l l e d   a f t e r   J A C S . n e x t   t h e n   t h e   c a l e n d a r   o b j e c t   m a y   n o t 
 
                                           e x i s t   ( i f   t h e   o b j e c t   h a s   n o t   b e e n   c r e a t e d   e a r l i e r   i n   t h e 
 
                                           u s e r s   p a t h   t h r o u g h   t h e   p a g e )   s o   a   J a v a S c r i p t   e r r o r   w o u l d 
 
                                           b e   g e n e r a t e d . 
 
 
 
                             E v e r y   f u n c t i o n   t h a t   i s   t r i g g e r e d   u s i n g   J A C S . n e x t ( )   a c q u i r e s   a n 
 
                             a t t r i b u t e   J A C S i d .   T h i s   a t t r i b u t e   h o l d s   t h e   v a l u e   o f   t h e 
 
                             c a l e n d a r   I D   t h a t   J A C S . n e x t ( )   h a s   b e e n   c a l l e d   f o r .   S o ,   y o u r 
 
                             f u n c t i o n   h a s   a c c e s s   t o   a l l   o f   t h e   c a l e n d a r   i n s t a n c e ' s   a t t r i b u t e s . 
 
                             T h e s e   i n c l u d e ; 
 
                                 d a t e R e t u r n e d     B o o l e a n   T R U E   i f   t h e   c a l e n d a r   h a s   b e e n   c l o s e d   b y 
 
                                                             s e l e c t i o n   o f   a   d a t e ,   o t h e r w i s e   F A L S E ) ,   a n d 
 
                                 o u t p u t D a t e         T h e   u s e r - s e l e c t e d   d a t e   i n   J a v a S c r i p t   d a t e   f o r m a t . 
 
 
 
                                         E . G .   d o c u m e n t . g e t E l e m e n t B y I d ( < < f u n c t i o n > > . J A C S i d ) . d a t e R e t u r n e d 
 
 
 
                 D i s a b l i n g   o r   e n a b l i n g   d a t e s   o r   d a t e   r a n g e s ; 
 
 
 
                             S e t t i n g   e n a b l e d   o r   d i s a b l e d   d a t e   r a n g e s   f o r   a   c a l e n d a r   o b j e c t   i s 
 
                             a c h i e v e d   b y   s e t t i n g   t h e   d a t e s   a r r a y   a t t r i b u t e   o f   t h e   c a l e n d a r   o b j e c t 
 
                             ( s e e   m o r e   i n f o r m a t i o n   b e l o w ) . 
 
 
 
                             B y   d e f a u l t   t h e   c a l e n d a r   o b j e c t   i s   o n l y   c r e a t e d   w h e n   i t   i s   f i r s t 
 
                             n e e d e d   f o r   d i s p l a y   s o   y o u   s h o u l d   m a k e   s u r e   t h a t   i t   i s   e x p l i c i t l y 
 
                             c r e a t e d   u s i n g ; 
 
 
 
                                         J A C S . m a k e ( < < c a l e n d a r   i d > > < < , d y n a m i c   ( b o o l e a n ,   d e f a u l t   T R U E ) > > ) ; 
 
 
 
                 C o m b i n i n g   t h e   t e c h n i q u e s : 
 
 
 
                             A   f u l l y   d e f i n e d   c a l l   t o   J A C S . s h o w ,   i n c l u d i n g   a l l   o p t i o n a l   p a r a m e t e r s 
 
                             s h o u l d   s e n d   p a r a m e t e r s   i n   t h e   f o l l o w i n g   o r d e r ; 
 
 
 
                                                         I / O             T r i g g e r     C a l e n d a r     S e l e c t e d 
 
                                                         E l e m e n t     E v e n t         I D                 d a y s 
 
                             D y n a m i c                   0                 1                 2                   2 / 3 
 
                             S t a t i c                     0                                   1                   1 / 2 
 
                             T y p e                     O b j e c t       O b j e c t       S t r i n g         N u m b e r ( s ) 
 
                             R e q u i r e d             Y e s             Y e s             N o                 N o 
 
                             D e f a u l t               N o n e           N o n e           ' j a c s '         N o n e 
 
 
 
                             N O T E :   T h e   T r i g g e r   E v e n t   i s   O N L Y   r e l e v a n t   f o r   d y n a m i c   c a l e n d a r s 
 
                                         a n d   m u s t   b e   o m i t t e d   f o r   s t a t i c   c a l e n d a r s . 
 
 
 
                             D y n a m i c   e . g .     J A C S . s h o w ( d o c u m e n t . g e t E l e m e n t B y I d ( ' m y E l e m e n t 1 ' ) , 
 
                                                                             e v e n t , ' j a c s ' , 0 , 1 , 2 , 3 , 4 , 5 , 6 ) ; 
 
 
 
                             S t a t i c     e . g .     J A C S . s h o w ( d o c u m e n t . g e t E l e m e n t B y I d ( ' m y E l e m e n t 2 ' ) , 
 
                                                                                       ' m y C a l ' , 0 , 6 ) ; 
 
 
 
                             A   s i n g l e   c a l e n d a r   i n s t a n c e   m u s t   n o t   b e   c a l l e d   w i t h   b o t h   D y n a m i c 
 
                             a n d   S t a t i c   p a r a m e t e r s   ( I t   i s   o n l y   o n e   s t r u c t u r e   w i t h i n   t h e   p a g e 
 
                             s o   i t   c a n n o t   r e m a i n   v i s i b l e   i n   o n e   l o c a t i o n   w h i l e   i t   i s   d i s p l a y e d 
 
                             i n   a n o t h e r ) . 
 
 
 
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
       S e e   h t t p : / / w w w . t a r r g e t . i n f o / c a l e n d a r / s c w . h t m   f o r   a   f u l l   v e r s i o n   h i s t o r y 
 
       u p   t o   v e r s i o n   3 . 6 0   a n d 
 
               h t t p : / / w w w . t a r r g e t . i n f o / c a l e n d a r / j a c s . h t m   f o r   v e r s i o n s   t o   d a t e . 
 
 
 
       V e r s i o n       D a t e                 B y                               D e s c r i p t i o n 
 
       = = = = = = =       = = = =                 = = = = = = = = = = = = = = =     = = = = = = = = = = = 
 
           1 . 3 0         2 0 0 8 - 0 5 - 0 5     A n t h o n y   G a r r e t t     A d d e d   o p t i o n a l   a u t o - p o s i t i o n i n g   o f   t h e 
 
                                                                                       c a l e n d a r   w h e n   i t s   n o r m a l   p o s i t i o n   w o u l d 
 
                                                                                       g o   o f f   t h e   v i s i b l e   a r e a . 
 
                                                                                       T h a n k s   t o   C h a n d r a m o u l i   I y e r   f o r   t h i s 
 
                                                                                       s u g g e s t i o n . 
 
                                                                                     A d d e d   a n   o p t i o n a l   " C l e a r "   b u t t o n   f o r 
 
                                                                                       u s e   w h e n   h a n d l i n g   a   r e a d - o n l y   t e x t 
 
                                                                                       i n p u t   e l e m e n t .   T h a n k s   t o   S a n j a y   G a n g w a l 
 
                                                                                       f o r   h i s   s u g g e s t i o n . 
 
 
 
           1 . 2 1         2 0 0 8 - 0 4 - 1 1     A n t h o n y   G a r r e t t     C o r r e c t e d   t h e   i n p u t   m o n t h   n a m e   p a r s i n g 
 
                                                                                         s o   t h a t   i t   s e t   t h e   c a l e n d a r   t o   t h e 
 
                                                                                         r i g h t   m o n t h   w h e n   l o n g   m o n t h   n a m e s   u s e d . 
 
                                                                                         T h a n k s   t o   B e n   D i a m a n d   f o r   t h i s   b u g   r e p o r t . 
 
 
 
           1 . 2 0         2 0 0 8 - 0 4 - 1 0     A n t h o n y   G a r r e t t     A d d e d   a t t r i b u t e   t o   a l l o w   c a l e n d a r   t o 
 
                                                                                       a p p e a r   i n   " d i s p l a y "   m o d e   o n l y   ( i . e . 
 
                                                                                       d a t e s   n o t   s e l e c t a b l e . 
 
 
 
                                                                                     A d d e d   t h e   o p t i o n   t o   h i g h l i g h t   s p e c i f i e d 
 
                                                                                       d a t e s   a n d   d a t e   r a n g e s . 
 
 
 
                                                                                     T h a n k s   t o   B e n   D i a m a n d   f o r   b o t h 
 
                                                                                       s u g g e s t i o n s . 
 
 
 
           1 . 1 1         2 0 0 8 - 0 2 - 2 4     A n t h o n y   G a r r e t t     T r a p p e d   c a l l s   t o   s c r i p t   w i t h   o n l y   a 
 
                                                                                       N A M E   a t t r i b u t e   i s   s e t   f o r   t h e   t a r g e t 
 
                                                                                       e l e m e n t   w h e n   t h e   s c r i p t   r e a l l y   r e q u i r e s 
 
                                                                                       a n   I D   a t t r i b u t e .     T h i s   i s   t h e   m o s t 
 
                                                                                       f r e q u e n t   m i s t a k e   r e p o r t e d   t o   m e . 
 
 
 
           1 . 1 0         2 0 0 8 - 0 1 - 1 4     A n t h o n y   G a r r e t t     R e s t o r e d   t h e   a b i l i t y   t o   u s e   a n   e l e m e n t 
 
                                                                                       a s   t h e   s e c o n d   p a r a m e t e r   w h e n   o p e n i n g   a 
 
                                                                                       d y n a m i c   c a l e n d a r   w h i l e   r e t a i n i n g   t h e 
 
                                                                                       o p t i o n   o f   p a s s i n g   a n   e v e n t .   T h a n k s   t o 
 
                                                                                       T h i e r r y   B l i n d   a n d   S e r g e y   S n o v s k y   f o r 
 
                                                                                       t h e   f e e d b a c k . 
 
 
 
                                                                                     A d d e d   a   c a l e n d a r   a t t r i b u t e   t h a t   h o l d s   t h e 
 
                                                                                       r e t u r n e d   d a t e .   T h i s   s i m p l i f i e s   u s e   o f 
 
                                                                                       t h e   c a l e n d a r   w i t h i n   J a v a S c r i p t .   T h a n k s 
 
                                                                                       t o   J u h a   V a l v a n n e   f o r   t h e   q u e r y   t h a t 
 
                                                                                       l e d   t o   t h i s   e n h a n c e m e n t . 
 
 
 
                                                                                     F i x e d   b u g   i n   t h e   h a n d l i n g   o f   f o c u s   e v e n t s 
 
                                                                                       t h a t   c a u s e d   c a l e n d a r   t o   f a i l   t o   a p p e a r . 
 
                                                                                       T h a n k s   t o   S t e v e   D a v i s   f o r   r e p o r t i n g   t h e 
 
                                                                                       p r o b l e m . 
 
 
 
           1 . 0 0         2 0 0 7 - 0 9 - 2 1     A n t h o n y   G a r r e t t     F i x e d   J A C S . n e x t   p a r a m e t e r s   -   t h a n k s   t o 
 
                                                                                       R o g i e r   L a n k h o r s t   f o r   t h e   f e e d b a c k ,   a l s o 
 
                                                                                       r e f i n e d   J A C S . n e x t   p r o c e s s i n g . 
 
 
 
                                                                                     U p d a t e d   t h e   e v e n t   t r a p p i n g   t o   m a k e   i t 
 
                                                                                       l e s s   i n t r u s i v e   o n   t h e   p a g e   b o d y .     N O T E : 
 
                                                                                       T h i s   r e q u i r e s   t h a t   a   d y n a m i c   c a l e n d a r ' s 
 
                                                                                       s e c o n d   p a r a m e t e r   s h o u l d   b e   t h e   c a l l i n g 
 
                                                                                       e v e n t   ( n o t   t h e   c a l l i n g   o b j e c t   a s   i n 
 
                                                                                       p r e v i o u s   v e r s i o n s ) .     T h a n k s   t o   S t e v e 
 
                                                                                       D a v i s   f o r   t h e   b u g   r e p o r t   t h a t   l e d   t o 
 
                                                                                       t h i s   c h a n g e . 
 
 
 
                                                                                     R e p l a c e d   t h e   d a t e   i n p u t   s e q u e n c e   u s e r 
 
                                                                                       c o n f i g u r a t i o n   s e t t i n g   w i t h   p a r s i n g   t h e 
 
                                                                                       s e q u e n c e   f r o m   t h e   f u l l   f o r m a t .   N e w   u s e r s 
 
                                                                                       a r e   o f t e n   c o n f u s e d   b y   t h e   s e q u e n c e   a n d 
 
                                                                                       i n   p r a c t i c e   ( t o   a l l o w   t h e   c a l e n d a r ' s   d a t e 
 
                                                                                       o u t p u t   t o   b e   u s e d   f o r   i n p u t )   t h e   s e q u e n c e 
 
                                                                                       m u s t   a l w a y s   m a t c h   t h e   f u l l   f o r m a t   e l e m e n t 
 
                                                                                       o r d e r . 
 
 
 
                                                                                     F i x e d   a   b u g   t h a t   c a u s e d   u n d e l i m i t e d 
 
                                                                                       d a t e s   t o   b e   h a n d l e d   i n c o r r e c t l y .   T h e y 
 
                                                                                       a r e   n o w   p a r s e d   a g a i n s t   t h e   f u l l   d a t e 
 
                                                                                       o u t p u t   f o r m a t   t h e n   c h e c k e d   f o r   v a l i d i t y . 
 
                                                                                       T h a n k s   t o   D a n   W o o d   f o r   r a i s i n g   t h i s   b u g . 
 
 
 
                                                                                     F i x e d   S t a n d a r d s - b a s e d   ( n o n   I E ) 
 
                                                                                       c a l e n d a r   d r a g g i n g   w h i c h   w a s n ' t   r e l e a s i n g 
 
                                                                                       t h e   c a l e n d a r   o n m o u s e u p . 
 
 
 
                                                                                     F i x e d   p r o b l e m   w h e r e   s e l e c t e d   w e e k d a y s 
 
                                                                                       c a r r i e d   o v e r   f r o m   o n e   c a l l   t o   a n o t h e r 
 
                                                                                       o n   t h e   s a m e   c a l e n d a r   o b j e c t . 
 
 
 
                                                                                     C o r r e c t e d   t h e   M o n t h   a n d   Y e a r   s e l e c t   b o x 
 
                                                                                       d i s p l a y s   i n   O p e r a .   T h e y   w e r e   n o t   c h a n g i n g 
 
                                                                                       w h e n   t h e   m o n t h   w a s   s h i f t e d   u s i n g   t h e 
 
                                                                                       c a l e n d a r ' s   l e f t   a n d   r i g h t   a r r o w s . 
 
 
 
                                                                                     E x t e n d e d   I F R A M E   b a c k i n g   t o   a l l   c a l e n d a r   o b j e c t s 
 
                                                                                       i n   o r d e r   t o   i m p r o v e   c a l e n d a r   d i s p l a y   o v e r 
 
                                                                                       s o m e   e m b e d d e d   a p p l e t s   a n d   o b j e c t s .     T h a n k s   t o 
 
                                                                                       S t a n k o   K u p c e v i c   f o r   h i s   f e e d b a c k   o n   t h i s . 
 
                                                                                       N O T E :   I t   i s   n o t   p o s s i b l e   t o   p r o t e c t   a n y 
 
                                                                                       J a v a S c r i p t   o b j e c t   d i s p l a y e d   o v e r   a n 
 
                                                                                       e m b e d d e d   D Y N A M I C   ( a n d ,   t h e r e f o r e   r e f r e s h e d ) 
 
                                                                                       o b j e c t   b e c a u s e   b r o w s e r s   u s u a l l y   d o   n o t 
 
                                                                                       d i r e c t l y   c o n t r o l   t h e   s c r e e n   h a n d l i n g   w i t h i n 
 
                                                                                       t h e   o b j e c t .     T h e   b e s t   a d v i c e   t h e r e f o r e   r e m a i n s 
 
                                                                                       t o   d e s i g n   p a g e s   i n   s u c h   a   w a y   t h a t   t h e   c a l e n d a r 
 
                                                                                       d o e s   n o t   o v e r l a p   e m b e d d e d   o b j e c t s . 
 
 
 
                                                                                   A d d e d   c u r l y   b r a c e s   a n d   s e m i - c o l o n s 
 
                                                                                       f o r   b e s t   p r a c t i c e   a n d   f o r   r o b u s t n e s s 
 
                                                                                       w h e n   c o d e   i s   c o m p a c t e d / o b f u s c a t e d . 
 
 
 
           0 . 9 0         2 0 0 7 - 0 4 - 0 4     A n t h o n y   G a r r e t t     M a j o r   r e - w r i t e   o f   t h e   s c r i p t   t o   a l l o w 
 
                                                                                       m u l t i p l e   c a l e n d a r   o b j e c t s   v i s i b l e   o n 
 
                                                                                       o n   t h e   p a g e ,   a n d   t o   a l l o w   s t a t i c 
 
                                                                                       c a l e n d a r s .   D r o p p e d   t h e   l e g a c y 
 
                                                                                       " s h o w C a l "   e n t r y - p o i n t   f u n c t i o n . 
 
 
 
                                                                                     A d d e d   a b i l i t y   t o   s e l e c t   c a l e n d a r 
 
                                                                                       p o s i t i o n   r e l a t i v e   t o   r e t u r n   v a l u e 
 
                                                                                       e l e m e n t .     T h a n k s   t o   J u s t i n   L a w r e n c e 
 
                                                                                       f o r   t h a t   r e q u e s t . 
 
 
 
 * / / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 
 
 / /   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 / /   S t a r t   o f   J a v a s c r i p t   A d v a n c e d   C a l e n d a r   S c r i p t   ( J A C S )   C o d e 
 
 / /   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 
 
 / *   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 
 
         E X P O S E D   C A L E N D A R   O B J E C T S   ( F U N C T I O N S ) : 
 
 
 
                 J A C S . m a k e       C r e a t e s   c a l e n d a r   o b j e c t s ; 
 
                                                 i s   c a l l e d   a s   p a r t   o f   J A C S . s h o w   ( i f   n e e d e d )   b u t   c a n   a l s o 
 
                                                 b e   c a l l e d   t o   c r e a t e   a   c a l e n d a r   i n s t a n c e   a t   a n y   t i m e . 
 
 
 
                 J A C S . s h o w       E n t r y   p o i n t   f o r   d i s p l a y   o f   a   c a l e n d a r :   C a l l e d   i n   m a i n   p a g e . 
 
 
 
                 J A C S . n e x t       S e t s   u p   a   f u n c t i o n   t h a t   r u n s   w h e n   a   d a t e   i s   s e l e c t e d   o n   a 
 
                                         s t a t i c   c a l e n d a r   o r   a   d y n a m i c   c a l e n d a r   m o v e s   o r   c l o s e s . 
 
 
 
                 J A C S . c a l s       r e t u r n s   a n   a r r a y   o f   a l l   t h e   c a l e n d a r   I D s   t h a t   h a v e   b e e n 
 
                                         u s e d   o n   t h e   p a g e . 
 
 
 
                                         N O T E S :   1   " u s e d "   h e r e   m e a n s :   I n v o k e d   w i t h   J A C S . m a k e   o r   J A C S . s h o w . 
 
                                                           C a l l s   w i t h o u t   a   d e f i n e d   c a l e n d a r   I D   i n v o k e   t h e   d e f a u l t 
 
                                                           I D ,   ' j a c s ' . 
 
 
 
                                                       2   E a c h   c a l e n d a r   s t r u c t u r e   i s   a d d e d   t o   t h e   p a g e   w h e n   i t 
 
                                                           i s   f i r s t   u s e d .   S o   t h i s   a r r a y   m a y   n o t   h o l d   a l l   d y n a m i c 
 
                                                           c a l e n d a r   I D s   t h a t   a r e   d e f i n e d   o n   t h e   p a g e .     I f   y o u 
 
                                                           w a n t   t o   b e   s u r e   t h a t   t h e   a r r a y   d o e s   s h o w   a l l   o f   t h e m , 
 
                                                           e x p l i c i t l y   i n v o k e     J A C s . m a k e ( < < I D > > ) ;   f o r   e a c h   I D   o n 
 
                                                           p a g e   l o a d . 
 
 
 
 * / / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 
 
 / /     N a m e s p a c e   J A C S 
 
 / /     - - - - - - - - - - - - - - 
 
 / /     T h i s   n a m e s p a c e   e n c a p s u l a t e s   a l l   t h e   c a l e n d a r   s c r i p t   c o d e   e l i m i n a t i n g 
 
 / /     n a m i n g   c o n f l i c t s   b e t w e e n   t h e   J a v a S c r i p t   i n   t h i s   s c r i p t   a n d   y o u r   c a l l i n g 
 
 / /     p a g e ( s )   [ a s   l o n g   a s   y o u   d o n ' t   u s e   J A C S   a s   a   v a r i a b l e   o f   c o u r s e ] .     I t   i s 
 
 / /     s t i l l   p o s s i b l e   f o r   C S S   i n h e r i t a n c e   t o   c a u s e   p r o b l e m s   b u t   t h a t   i s   u n a v o i d a b l e . 
 
 
 
 v a r   J A C S   =   n e w   f u n c t i o n ( ) 
 
         { / /   T h i s   d a t e   i s   u s e d   t h r o u g h o u t   t o   d e t e r m i n e   t o d a y ' s   d a t e . 
 
           v a r   d a t e N o w   =   n e w   D a t e ( D a t e . p a r s e ( n e w   D a t e ( ) . t o D a t e S t r i n g ( ) ) ) ; 
 
 
 
           / /   T h i s   a r r a y   k e e p s   t r a c k   o f   t h e   d e f i n e d   c a l e n d a r s   f o r   t h e   p a g e . 
 
           v a r   c a l s   =   n e w   A r r a y ( ) ; 
 
           v a r   _ d L i s t = n e w   A r r a y ( ) ; 
 
           v a r   _ b Y e a r , _ d Y e a r ; 
 
           v a r   _ f D a y ,   _ b D a y ; 
 
           v a r   _ x B a s e ; 
 
 
 
           / /   T h i s   f u n c t i o n   s h o r t e n s   t h e   c o d e   r e p l a c i n g 
 
           / /   d o c u m e n t . g e t E l e m e n t B y I d ( ' m y I D ' )   w i t h   g e t E l ( ' m y I d ' ) 
 
           / /   e v e r y w h e r e   i n   t h e   s c r i p t .   I t   a l s o   t r i e s   t o   h a n d l e   a   c o m m o n 
 
           / /   e r r o r   w h e n   c a l l i n g   t h e   s c r i p t :   w h e n   t h e   d e v e l o p e r   h a s   o n l y 
 
           / /   s e t   a   N A M E   a t t r i b u t e   v a l u e ,   s o   n o   I D   a t t r i b u t e   i s   s e t . 
 
           f u n c t i o n   g e t E l ( i d ) 
 
                   { i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( i d )   | |   ( ! d o c u m e n t . g e t E l e m e n t B y I d ( i d )   & &   d o c u m e n t . g e t E l e m e n t s B y N a m e ( i d ) . l e n g t h = = 0 ) ) 
 
                                                                         / /   I F       A n   I D   a t t r i b u t e   i s   a s s i g n e d 
 
                                                                         / /   O R       N o   I D   a t t r i b u t e   i s   a s s i g n e d   b u t   u s i n g   I E   a n d   O p e r a 
 
                                                                         / /                     ( w h i c h   w i l l   f i n d   t h e   N A M E   a t t r i b u t e   v a l u e   u s i n g   g e t E l e m e n t B y I d ) 
 
                                                                         / /   O R       N o   e l e m e n t   h a s   t h i s   I D   o r   N A M E   a t t r i b u t e   v a l u e 
 
                                                                         / /                     ( u s e d   i n t e r n a l l y   b y   t h e   s c r i p t ) 
 
                                                                         / /   T H E N   R e t u r n   t h e   r e q u i r e d   e l e m e n t . 
 
                                 { r e t u r n   d o c u m e n t . g e t E l e m e n t B y I d ( i d ) ; } 
 
                     e l s e     { i f   ( d o c u m e n t . g e t E l e m e n t s B y N a m e ( i d ) . l e n g t h = = 1 ) 
 
                                                                         / /   I F       N o   I D   a t t r i b u t e   i s   a s s i g n e d 
 
                                                                         / /   A N D     U s i n g   a   s t a n d a r d s - b a s e d   b r o w s e r 
 
                                                                         / /   A N D     O n l y   o n e   e l e m e n t   h a s   t h e   N A M E   a t t r i b u t e   s e t   t o   t h e   v a l u e 
 
                                                                         / /   T H E N   R e t u r n   t h e   r e q u i r e d   e l e m e n t   ( u s i n g   t h e   N A M E   a t t r i b u t e   v a l u e ) . 
 
                                                 { r e t u r n   d o c u m e n t . g e t E l e m e n t s B y N a m e ( i d ) [ 0 ] ; } 
 
                                   e l s e       { i f   ( d o c u m e n t . g e t E l e m e n t s B y N a m e ( i d ) . l e n g t h > 1 ) 
 
                                                                 {       / /   I F       N o   I D   a t t r i b u t e   i s   a s s i g n e d 
 
                                                                         / /   A N D     u s i n g   a   s t a n d a r d s - b a s e d   b r o w s e r 
 
                                                                         / /   A N D     m o r e   t h a n   o n e   e l e m e n t   h a s   t h e   N A M E   a t t r i b u t e   s e t   t o   t h e   v a l u e 
 
                                                                         / /   T H E N   a l e r t   d e v e l o p e r   t o   f i x   t h e   f a u l t . 
 
                                                                   a l e r t (   ' J A C S '   + 
 
                                                                                 '   \ n C a n n o t   u n i q u e l y   i d e n t i f y   e l e m e n t   n a m e d :   '   +   i d   + 
 
                                                                                 ' . \ n M o r e   t h a n   o n e   i d e n t i c a l   N A M E   a t t r i b u t e   d e f i n e d '   + 
 
                                                                                 ' . \ n S o l u t i o n :   A s s i g n   t h e   r e q u i r e d   e l e m e n t   a   u n i q u e   I D   a t t r i b u t e   v a l u e . ' ) ; 
 
                                                                 } 
 
                                                 } 
 
                                 } 
 
                   } ; 
 
 
 
 
 
           f u n c t i o n   c a l A t t r i b u t e s ( c a l ) 
 
                 { s w i t c h   ( c a l . i d ) 
 
                         { c a s e   ' E n t e r Y o u r I D H e r e ' : 
 
 
 
                                 / /   I f   y o u   w a n t   t o   v a r y   t h e   a t t r i b u t e s   f o r   a   s p e c i f i c   i n s t a n c e 
 
                                 / /   o f   t h e   c a l e n d a r ,   r e p l a c e   ' E n t e r Y o u r I D H e r e '   ( a b o v e )   w i t h   t h e 
 
                                 / /   I D   t h a t   y o u   h a v e   d e f i n e d   f o r   t h a t   c a l e n d a r   t h e n   a m e n d   a n d 
 
                                 / /   u n c o m m e n t   t h e   b l o c k - c o m m e n t e d   s e c t i o n   b e l o w   ( w h i c h   i s   j u s t 
 
                                 / /   a   c o p y   o f   t h e   d e f a u l t   s e c t i o n   b e l o w   w i t h   a l l   t h e 
 
                                 / /   d o c u m e n t a t i o n   c o m m e n t s   r e m o v e d ) . 
 
 
 
                                 / * 
 
 
 
                                 c a l . z I n d e x                                       =   1 ; 
 
                                 c a l . b a s e Y e a r                                   =   d a t e N o w . g e t F u l l Y e a r ( ) - 1 0 ; 
 
                                 c a l . d r o p D o w n Y e a r s                         =   2 0 ; 
 
                                 c a l . w e e k S t a r t                                 =   1 ; 
 
                                 c a l . w e e k N u m b e r B a s e D a y                 =   4 ; 
 
                                 c a l . w e e k N u m b e r D i s p l a y                 =   f a l s e ; 
 
 
 
                                 t r y       { j a c s S e t L a n g u a g e ( c a l ) ; } 
 
                                 c a t c h   ( e x c e p t i o n ) 
 
                                         { c a l . t o d a y                               =   ' T o d a y : ' ; 
 
                                           c a l . c l e a r                               =   ' C l e a r ' ; 
 
                                           c a l . d r a g                                 =   ' c l i c k   h e r e   t o   d r a g ' ; 
 
                                           c a l . m o n t h N a m e s                     =   [ ' J a n ' , ' F e b ' , ' M a r ' , ' A p r ' , ' M a y ' , ' J u n ' , 
 
                                                                                                 ' J u l ' , ' A u g ' , ' S e p ' , ' O c t ' , ' N o v ' , ' D e c ' ] ; 
 
                                           c a l . w e e k I n i t s                       =   [ ' S ' , ' M ' , ' T ' , ' W ' , ' T ' , ' F ' , ' S ' ] ; 
 
                                           c a l . i n v a l i d D a t e M s g             =   ' T h e   e n t e r e d   d a t e   i s   i n v a l i d . \ n ' ; 
 
                                           c a l . o u t O f R a n g e M s g               =   ' T h e   e n t e r e d   d a t e   i s   o u t   o f   r a n g e . ' ; 
 
                                           c a l . d o e s N o t E x i s t M s g           =   ' T h e   e n t e r e d   d a t e   d o e s   n o t   e x i s t . ' ; 
 
                                           c a l . i n v a l i d A l e r t                 =   [ ' I n v a l i d   d a t e   ( ' , ' )   i g n o r e d . ' ] ; 
 
                                           c a l . d a t e S e t t i n g E r r o r         =   [ ' E r r o r   ' , '   i s   n o t   a   D a t e   o b j e c t . ' ] ; 
 
                                           c a l . r a n g e S e t t i n g E r r o r       =   [ ' E r r o r   ' , '   s h o u l d   c o n s i s t   o f   t w o   e l e m e n t s . ' ] ; 
 
                                         } 
 
 
 
                                 c a l . s h o w I n v a l i d D a t e M s g               =   t r u e ; 
 
                                 c a l . s h o w O u t O f R a n g e M s g                 =   t r u e ; 
 
                                 c a l . s h o w D o e s N o t E x i s t M s g             =   t r u e ; 
 
                                 c a l . s h o w I n v a l i d A l e r t                   =   t r u e ; 
 
                                 c a l . s h o w D a t e S e t t i n g E r r o r           =   t r u e ; 
 
                                 c a l . s h o w R a n g e S e t t i n g E r r o r         =   t r u e ; 
 
                                 c a l . d e l i m i t e r s                               =   [ ' / ' , ' - ' , ' . ' , ' : ' , ' , ' , '   ' ] ; 
 
                                 c a l . d a t e D i s p l a y F o r m a t                 =   ' d d - m m - y y ' ; 
 
                                 c a l . d a t e F o r m a t                               =   ' D D   M M M ,   Y Y Y Y ' ; 
 
                                 c a l . s t r i c t                                       =   f a l s e ; 
 
                                 c a l . d a t e s                                         =   n e w   A r r a y ( ) ; 
 
                                 c a l . h i g l i g h t D a t e s                         =   n e w   A r r a y ( ) ; 
 
                                 c a l . d a y C e l l s                                   =   [ t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e , 
 
                                                                                                 t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e , 
 
                                                                                                 t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e , 
 
                                                                                                 t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e , 
 
                                                                                                 t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e , 
 
                                                                                                 t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ] ; 
 
                                 c a l . o u t O f R a n g e D i s a b l e                 =   t r u e ; 
 
                                 c a l . o u t O f M o n t h D i s a b l e                 =   f a l s e ; 
 
                                 c a l . o u t O f M o n t h H i d e                       =   f a l s e ; 
 
                                 c a l . f o r m a t T o d a y C e l l                     =   t r u e ; 
 
                                 c a l . t o d a y C e l l B o r d e r C o l o u r         =   ' r e d ' ; 
 
                                 c a l . a l l o w D r a g                                 =   f a l s e ; 
 
                                 c a l . o n B l u r M o v e N e x t                       =   f a l s e ; 
 
                                 c a l . c l i c k T o H i d e                             =   f a l s e ; 
 
                                 c a l . x B a s e                                         =   ' L ' ;         / /   L   L e f t ,   M   M i d d l e ,   R   R i g h t     o r   i n t e g e r   p i x e l   o f f s e t   f r o m   l e f t 
 
                                 c a l . y B a s e                                         =   ' B ' ;         / /   T   T o p ,     M   M i d d l e ,   B   B o t t o m   o r   i n t e g e r   p i x e l   o f f s e t   f r o m   t o p 
 
                                 c a l . x P o s i t i o n                                 =   ' L ' ;         / /   L   L e f t ,   M   M i d d l e ,   R   R i g h t     o r   i n t e g e r   p i x e l   o f f s e t   f r o m   l e f t 
 
                                 c a l . y P o s i t i o n                                 =   ' T ' ;         / /   T   T o p ,     M   M i d d l e ,   B   B o t t o m   o r   i n t e g e r   p i x e l   o f f s e t   f r o m   t o p 
 
                                 c a l . a u t o P o s i t i o n                           =   t r u e ; 
 
                                 * / 
 
 
 
                                 b r e a k ; 
 
                           d e f a u l t : 
 
 
 
                                 / /   c a l . z I n d e x   c o n t r o l s   h o w   t h e   p o p - u p   c a l e n d a r   i n t e r a c t s   w i t h 
 
                                 / /   t h e   r e s t   o f   t h e   p a g e .     I t   i s   u s u a l l y   a d e q u a t e   t o   l e a v e   i t 
 
                                 / /   a s   1   ( O n e )   b u t   I   h a v e   m a d e   i t   a v a i l a b l e   h e r e   t o   h e l p   a n y o n e 
 
                                 / /   w h o   n e e d s   t o   a l t e r   t h e   l e v e l   i n   o r d e r   t o   e n s u r e   t h a t   t h e 
 
                                 / /   c a l e n d a r   d i s p l a y s   c o r r e c t l y   i n   r e l a t i o n   t o   a l l   o t h e r   e l e m e n t s 
 
                                 / /   o n   t h e   p a g e . 
 
 
 
                                 c a l . z I n d e x   =   1 ; 
 
 
 
                                 / /   S e t   t h e   b o u n d s   f o r   t h e   c a l e n d a r   h e r e . . . 
 
                                 / /   I f   y o u   w a n t   t h e   y e a r   t o   r o l l   f o r w a r d   y o u   c a n   u s e   s o m e t h i n g 
 
                                 / /   l i k e   t h i s . . . 
 
                                 / /             v a r   b a s e Y e a r   =   d a t e N o w . g e t F u l l Y e a r ( ) - 5 ; 
 
                                 / /   a l t e r n a t i v e l y ,   h a r d   c o d e   a   d a t e   l i k e   t h i s . . . 
 
                                 / /             v a r   b a s e Y e a r   =   1 9 9 0 ; 
 
 
 
                                 c a l . b a s e Y e a r   =   d a t e N o w . g e t F u l l Y e a r ( ) + ( _ b Y e a r ! = u n d e f i n e d ? _ b Y e a r : - 1 0 ) ; 
 
 
 
                                 / /   H o w   m a n y   y e a r s   d o   w a n t   t o   b e   v a l i d   a n d   t o   s h o w   i n   t h e 
 
                                 / /   d r o p - d o w n   l i s t ? 
 
 
 
                                 c a l . d r o p D o w n Y e a r s   =   _ d Y e a r ? _ d Y e a r : 2 0 ; 
 
 
 
                                 / /   w e e k S t a r t   d e t e r m i n e s   t h e   s t a r t   o f   t h e   w e e k   i n   t h e   d i s p l a y 
 
                                 / /   S e t   i t   t o :   0   ( Z e r o )   f o r   S u n d a y ,   1   ( O n e )   f o r   M o n d a y   e t c . . 
 
 
 
                                 / /   N o t e :     A l w a y s   s t a r t   t h e   w e e k I n i t s   a r r a y   w i t h   y o u r 
 
                                 / /                 s t r i n g   f o r   S u n d a y   w h a t e v e r   w e e k S t a r t   ( b e l o w ) 
 
                                 / /                 i s   s e t   t o . 
 
 
 
                                 c a l . w e e k S t a r t   =   0 ; 
 
 
 
                                 / /   W e e k   n u m b e r i n g   r u l e s   a r e   g e n e r a l l y   b a s e d   o n   a   d a y   i n   t h e   w e e k 
 
                                 / /   t h a t   d e t e r m i n e s   t h e   f i r s t   w e e k   o f   t h e   y e a r .     I S O   8 6 0 1   u s e s 
 
                                 / /   T h u r s d a y   ( d a y   f o u r   w h e n   S u n d a y   i s   d a y   z e r o ) .     Y o u   c a n   a l t e r 
 
                                 / /   t h e   b a s e   d a y   h e r e . 
 
 
 
                                 / /   S e e   h t t p : / / w w w . c l . c a m . a c . u k / ~ m g k 2 5 / i s o - t i m e . h t m l 
 
                                 / /   f o r   m o r e   i n f o r m a t i o n 
 
 
 
                                 c a l . w e e k N u m b e r B a s e D a y   =   4 ; 
 
 
 
                                 / /   T h e   w e e k   s t a r t   d a y   f o r   t h e   d i s p l a y   i s   t a k e n   a s   t h e   w e e k   s t a r t 
 
                                 / /   f o r   w e e k   n u m b e r i n g .     T h i s   e n s u r e s   t h a t   o n l y   o n e   w e e k   n u m b e r 
 
                                 / /   a p p l i e s   t o   o n e   l i n e   o f   t h e   c a l e n d a r   t a b l e . 
 
                                 / /   [ I S O   8 6 0 1   b e g i n s   t h e   w e e k   w i t h   D a y   1   =   M o n d a y . ] 
 
 
 
                                 / /   I f   y o u   w a n t   t o   s e e   w e e k   n u m b e r i n g   o n   t h e   c a l e n d a r ,   s e t 
 
                                 / /   t h i s   t o   t r u e .     I f   n o t ,   f a l s e . 
 
 
 
                                 c a l . w e e k N u m b e r D i s p l a y   =   f a l s e ; 
 
 
 
                                 / /   I f   t h e   c a l e n d a r   i s   g i v e n   a   d a t e   t h a t   i t   c a n ' t   p a r s e   a   m o n t h 
 
                                 / /   f r o m ,   i t   w i l l   u s e   a   d e f a u l t   m o n t h .     I f   t h e   f o l l o w i n g   a t t r i b u t e 
 
                                 / /   i s   F A L S E   t h e n   t h e   d e f a u l t   m o n t h   i s   m o n t h   6   ( J u n e ) ,   i f   s e t   t o 
 
                                 / /   T R U E   t h e n   t h e   d e f a u l t   w i l l   b e   t h e   c u r r e n t   m o n t h . 
 
 
 
                                 c a l . d e f a u l t T o C u r r e n t M o n t h   =   f a l s e ; 
 
 
 
                                 / /   A l l   l a n g u a g e - d e p e n d e n t   s e t t i n g s   c a n   b e   m a d e   h e r e . . . 
 
 
 
                                 / /   I f   y o u   w i s h   t o   w o r k   i n   a   s i n g l e   l a n g u a g e   ( o t h e r   t h a n   E n g l i s h ) 
 
                                 / /   t h e n   j u s t   r e p l a c e   t h e   E n g l i s h   b e l o w   w i t h   y o u r   o w n   t e x t . 
 
 
 
                                 / /   U s i n g   m u l t i p l e   l a n g u a g e s : 
 
                                 / /   I n   o r d e r   t o   k e e p   t h i s   s c r i p t   t o   a   r e s o n a b l e   s i z e   I   h a v e   n o t 
 
                                 / /   i n c l u d e d   m u l t i p l e   l a n g u a g e s   h e r e .     H o w e v e r ,   y o u   c a n   s e t   t h e   l a n g u a g e 
 
                                 / /   f i e l d s   i n   a   f u n c t i o n   t h a t   y o u   s h o u l d   n a m e     j a c s S e t L a n g u a g e .     T h e   s c r i p t 
 
                                 / /   w i l l   t h e n   u s e   y o u r   l a n g u a g e s .   I   h a v e   i n c l u d e d   a l l   t h e   t r a n s l a t i o n s 
 
                                 / /   t h a t   h a v e   b e e n   s e n t   t o   m e   i n   s u c h   a   f u n c t i o n   o n   m y   d e m o n s t r a t i o n 
 
                                 / /   s i t e   a t   h t t p : / / w w w . t a r r g e t . i n f o / c a l e n d a r / j a c s L a n g u a g e s . j s . 
 
 
 
                                 / /   g b 
 
                                 c a l . l a n g u a g e                         =   ' g b ' ; 
 
                                 c a l . t o d a y                               =   ' N)Y: ' ; 
 
                                 c a l . c l e a r                               =   ' nd' ; 
 
                                 c a l . d r a g                                 =   ' c l i c k   h e r e   t o   d r a g ' ; 
 
                                 c a l . m o n t h N a m e s                     =   [ ' 1 g' , ' 2 g' , ' 3 g' , ' 4 g' , ' 5 g' , ' 6 g' , 
 
                                                                                       ' 7 g' , ' 8 g' , ' 9 g' , ' 1 0 g' , ' 1 1 g' , ' 1 2 g' ] ; 
 
                                 c a l . w e e k I n i t s                       =   [ ' e' , '  N' , ' N' , ' 	N' , ' V' , ' N' , ' mQ' ] ; 
 
                                 c a l . i n v a l i d D a t e M s g             =   ' T h e   e n t e r e d   d a t e   i s   i n v a l i d . \ n ' ; 
 
                                 c a l . o u t O f R a n g e M s g               =   ' T h e   e n t e r e d   d a t e   i s   o u t   o f   r a n g e . ' ; 
 
                                 c a l . d o e s N o t E x i s t M s g           =   ' T h e   e n t e r e d   d a t e   d o e s   n o t   e x i s t . ' ; 
 
                                 c a l . i n v a l i d A l e r t                 =   [ ' I n v a l i d   d a t e   ( ' , ' )   i g n o r e d . ' ] ; 
 
                                 c a l . d a t e S e t t i n g E r r o r         =   [ ' E r r o r   ' , '   i s   n o t   a   D a t e   o b j e c t . ' ] ; 
 
                                 c a l . r a n g e S e t t i n g E r r o r       =   [ ' E r r o r   ' , '   s h o u l d   c o n s i s t   o f   t w o   e l e m e n t s . ' ] ; 
 
 
 
                                 / /   E a c h   o f   t h e   c a l e n d a r ' s   a l e r t   m e s s a g e   t y p e s   c a n   b e   d i s a b l e d 
 
                                 / /   i n d e p e n d e n t l y   h e r e . 
 
 
 
                                 c a l . s h o w I n v a l i d D a t e M s g             =   f a l s e ; 
 
                                 c a l . s h o w O u t O f R a n g e M s g               =   t r u e ; 
 
                                 c a l . s h o w D o e s N o t E x i s t M s g           =   t r u e ; 
 
                                 c a l . s h o w I n v a l i d A l e r t                 =   t r u e ; 
 
                                 c a l . s h o w D a t e S e t t i n g E r r o r         =   t r u e ; 
 
                                 c a l . s h o w R a n g e S e t t i n g E r r o r       =   t r u e ; 
 
 
 
                                 / /   S e t   t h e   w h o l e   c a l e n d a r   a s   a c t i v e   ( d a t e s   s e l e c t a b l e ) 
 
                                 / /   o r   i n a c t i v e   ( d i s p l a y   o n l y ) 
 
 
 
                                 c a l . a c t i v e   =   t r u e ; 
 
 
 
                                 / /   S e t   t h e   a l l o w e d   i n p u t   d a t e   d e l i m i t e r s   h e r e . . . 
 
                                 / /   E . g .   T o   s e t   t h e   r i s i n g   s l a s h ,   h y p h e n ,   f u l l - s t o p   ( a k a   s t o p   o r 
 
                                 / /             p o i n t ) ,   c o l o n ,   c o m m a   a n d   s p a c e   a s   d e l i m i t e r s   u s e 
 
                                 / /                             v a r   c a l . d e l i m i t e r s       =   [ ' / ' , ' - ' , ' . ' , ' : ' , ' , ' , '   ' ] ; 
 
 
 
                                 c a l . d e l i m i t e r s   =   [ ' / ' , ' - ' , ' . ' , ' : ' , ' , ' , '   ' ] ; 
 
 
 
                                 / /   S e t   t h e   f o r m a t   f o r   t h e   d i s p l a y e d   ' T o d a y '   d a t e   a n d   f o r   t h e 
 
                                 / /   o u t p u t   d a t e   h e r e . 
 
                                 / / 
 
                                 / /   T h e   f o r m a t   i s   d e s c r i b e d   u s i n g   d e l i m i t e r s   o f   y o u r   c h o i c e   ( a s 
 
                                 / /   s e t   i n   c a l . d e l i m i t e r s   a b o v e )   a n d   c a s e   i n s e n s i t i v e   l e t t e r s 
 
                                 / /   D ,   M   a n d   Y . 
 
                                 / / 
 
                                 / /   N O T E :   I f   n o   d e l i m i t e r s   a r e   i n p u t   t h e n   t h e   d a t e   o u t p u t   f o r m a t   i s   u s e d 
 
                                 / /               t o   p a r s e   t h e   v a l u e .     T h i s   a l l o w s   l e s s   f l e x i b l i l i t y   i n   t h e   i n p u t 
 
                                 / /               v a l u e   t h a n   u s i n g   d e l i m i t e r s   b u t   a n   a c c u r a t e l y   e n t e r e d   d a t e 
 
                                 / /               r e m a i n s   p a r s a b l e . 
 
 
 
                                 / /   D i s p l a y e d   " T o d a y "   d a t e   f o r m a t 
 
 
 
                                 / / c a l . d a t e D i s p l a y F o r m a t   =   ' d d / m m / y y y y ' ;           / /   e . g .   ' M M M - D D - Y Y Y Y '   f o r   t h e   U S 
 
                                 c a l . d a t e D i s p l a y F o r m a t   =   ' y y y y / M M / d d ' ; 
 
 
 
                                 / /   O u t p u t   d a t e   f o r m a t 
 
 
 
                                 / / c a l . d a t e F o r m a t     =   ' D D - M M M - Y Y Y Y ' ;   / /   e . g .   ' M M M - D D - Y Y Y Y '   f o r   t h e   U S 
 
                                 c a l . d a t e F o r m a t     =   ' y y y y - M - d ' ; 
 
                                 
 
                                 / /   N o t e :   T h e   d e l i m i t e r s   u s e d   s h o u l d   b e   i n   c a l . d e l i m i t e r s . 
 
 
 
                                 / /   P e r s o n a l l y   I   l i k e   t h e   f a c t   t h a t   e n t e r i n g   3 1 - S e p - 2 0 0 5   ( a   d a t e 
 
                                 / /   t h a t   d o e s n ' t   e x i s t )   d i s p l a y s   1 - O c t - 2 0 0 5 ,   h o w e v e r   y o u   m a y   w a n t 
 
                                 / /   t h a t   t o   b e   a n   e r r o r .     I f   s o ,   s e t   c a l . s t r i c t   =   t r u e .     T h a t 
 
                                 / /   w i l l   c a u s e   a n   e r r o r   m e s s a g e   t o   d i s p l a y   a n d   t h e   s e l e c t e d   m o n t h 
 
                                 / /   i s   d i s p l a y e d   w i t h o u t   a   s e l e c t e d   d a y .   T h a n k s   t o   B r a d   A l l a n   f o r 
 
                                 / /   h i s   f e e d b a c k   p r o m p t i n g   t h i s   f e a t u r e . 
 
 
 
                                 c a l . s t r i c t   =   f a l s e ; 
 
 
 
                                 / /   I f   y o u   a r e   u s i n g   R e a d O n l y   o r   d i a a b l e d   f i e l d s   t o   r e t u r n   t h e   d a t e 
 
                                 / /   v a l u e   i n t o ,   i t   c a n   b e   u s e f u l   t o   s h o w   a   b u t t o n   o n   t h e   c a l e n d a r 
 
                                 / /   t h a t   a l l o w s     t h e   v a l u e   t o   b e   c l e a r e d .     I f   y o u   w a n t   t o   d o   t h a t , 
 
                                 / /   s e t   c a l . c l e a r B u t t o n   =   t r u e ; 
 
 
 
                                 c a l . c l e a r B u t t o n   =   t r u e ; 
 
 
 
                                 / /   C h o o s e   w h e t h e r   t h e   d a t e s   a n d   d a y s   y o u   s p e c i f y   i n   c a l . d a t e s 
 
                                 / /   a n d   a s   p a r a m e t e r s   t o   t h e   J A C S . s h o w   c a l l   a r e   e n a b l e d   ( w i t h   a l l 
 
                                 / /   o t h e r   d a t e s   d i s a b l e d )   o r   d i s a b l e d   ( w i t h   a l l   o t h e r   d a t e s   e n a b l e d ) . 
 
 
 
                                 c a l . v a l u e s E n a b l e d   =   f a l s e ; 
 
 
 
                                 / /   I f   y o u   w i s h   t o   s e t   a n y   d i s p l a y e d   d a y ,   e . g .   E v e r y   M o n d a y , 
 
                                 / /   y o u   c a n   d o   i t   u s i n g   t h e   f o l l o w i n g   a r r a y .     T h e   a r r a y   e l e m e n t s 
 
                                 / /   m a t c h   t h e   d i s p l a y e d   c e l l s . 
 
                                 / / 
 
                                 / /   W i t h   t h e   v a l u e s E n a b l e d   a t t r i b u t e   F A L S E   y o u   c o u l d   p u t   s o m e t h i n g 
 
                                 / /   l i k e   t h e   f o l l o w i n g   i n   y o u r   c a l l i n g   p a g e   t o   d i s a b l e   a l l   w e e k e n d 
 
                                 / /   d a y s ; 
 
                                 / / 
 
                                 / /     f o r   ( v a r   i = 0 ; i < < < c a l e n d a r   o b j e c t > > . d a y C e l l s . l e n g t h ; i + + ) 
 
                                 / /             { i f   ( i % 7 % 6 = = 0 )   < < c a l e n d a r   o b j e c t > > . d a y C e l l s [ i ]   =   f a l s e ; } 
 
                                 / / 
 
                                 / /   T h e   a b o v e   a p p r o a c h   w i l l   a l l o w   y o u   t o   s e l e c t   d a y s   o f   t h e   w e e k 
 
                                 / /   f o r   t h e   w h o l e   o f   y o u r   p a g e   e a s i l y .     I f   y o u   n e e d   t o   s e t   d i f f e r e n t 
 
                                 / /   s e l e c t e d   d a y s   f o r   a   n u m b e r   o f   d a t e   i n p u t   f i e l d s   o n   y o u r   p a g e 
 
                                 / /   t h e r e   i s   a n   e a s i e r   w a y :   Y o u   c a n   p a s s   o p t i o n a l   a r g u m e n t s   t o 
 
                                 / /   J A C S . s h o w .   T h e   s y n t a x   i s   d e s c r i b e d   a t   t h e   t o p   o f   t h i s   s c r i p t   i n 
 
                                 / /   t h e   s e c t i o n : 
 
                                 / /         " H o w   t o   u s e   t h e   C a l e n d a r   o n c e   i t   i s   d e f i n e d   f o r   y o u r   p a g e : " 
 
                                 / / 
 
                                 / /   I t   i s   p o s s i b l e   t o   u s e   t h e s e   t w o   a p p r o a c h e s   i n   c o m b i n a t i o n . 
 
 
 
                                 c a l . d a y C e l l s   =   [ t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e , 
 
                                                                 t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e , 
 
                                                                 t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e , 
 
                                                                 t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e , 
 
                                                                 t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e , 
 
                                                                 t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ] ; 
 
 
 
                                 / /   Y o u   c a n   s p e c i f y   a n y   d a t e   ( e . g .   2 4 - J a n - 2 0 0 6   o r   T o d a y )   b y   c r e a t i n g 
 
                                 / /   a n   e l e m e n t   o f   t h e   a r r a y   c a l . d a t e s   a s   a   d a t e   o b j e c t   w i t h   t h e 
 
                                 / /   v a l u e   y o u   w a n t   t o   h a n d l e .     D a t e   r a n g e s   c a n   b e   h a n d l e d   b y   p l a c i n g 
 
                                 / /   a n   a r r a y   o f   t w o   v a l u e s   ( S t a r t   a n d   E n d )   i n t o   a n   e l e m e n t   o f   t h i s   a r r a y . 
 
                                 / / 
 
                                 / /   U s e   c a l . v a l u e s E n a b l e d   t o   d e t e r m i n e   w h e t h e r   a n y   s p e c i f i e d   d a t e s 
 
                                 / /   a r e   t r e a t e d   a s   t h e   o n l y   e n a b l e d   o n e s   o r   t h e   o n l y   d i s a b l e d   o n e s . 
 
 
 
                                 c a l . d a t e s   =   n e w   A r r a y ( ) ; 
 
                                 
 
                                 / /   a d d   b y   c 
 
                                 i f ( _ d L i s t . l e n g t h > 0 ) 
 
                                 { 
 
                                 	 f o r ( v a r   i = 0 ; i < _ d L i s t . l e n g t h ; c a l . d a t e s . p u s h ( _ d L i s t [ i + + ] ) ) ; 
 
                                 } 
 
                               	 i f   ( _ f D a y ! = u n d e f i n e d   & &   _ b D a y ! = u n d e f i n e d )   { 
 
                                 	 c a l . d a t e s . p u s h ( 
 
                                         	 [ n e w   D a t e ( c a l . b a s e Y e a r , 0 , 0 ) , 
 
                                                   n e w   D a t e ( d a t e N o w . g e t F u l l Y e a r ( ) , 
 
                                                   d a t e N o w . g e t M o n t h ( ) , 
 
                                                   d a t e N o w . g e t D a t e ( ) + _ f D a y ) ] ) ; 
 
                                 	 c a l . d a t e s . p u s h ( 
 
                                         	 [ n e w   D a t e ( d a t e N o w . g e t F u l l Y e a r ( ) , 
 
                                                   d a t e N o w . g e t M o n t h ( ) , 
 
                                                   d a t e N o w . g e t D a t e ( ) + _ f D a y + _ b D a y + 1 ) , 
 
                                                   n e w   D a t e ( c a l . d r o p D o w n Y e a r s + c a l . b a s e Y e a r , 1 2 , 3 1 ) ] ) ; 
 
                                 } 
 
 	 	 	 	 e l s e   i f   ( _ f D a y ! = u n d e f i n e d ) 
 
 	 	 	 	 	 c a l . d a t e s . p u s h ( 
 
 	 	 	 	 	 	 [ n e w   D a t e ( c a l . b a s e Y e a r , 0 , 1 ) , 
 
 	 	 	 	 	 	 n e w   D a t e ( d a t e N o w . g e t F u l l Y e a r ( ) , 
 
 	 	 	 	 	 	 d a t e N o w . g e t M o n t h ( ) , 
 
 	 	 	 	 	 	 d a t e N o w . g e t D a t e ( ) + _ f D a y ) ] ) ; 
 
 
 
                                 / /   e . g .   T o   s p e c i f y   1 0 - D e c - 2 0 0 5 : 
 
                                 / /                     c a l . d a t e s [ 0 ]   =   n e w   D a t e ( 2 0 0 5 , 1 1 , 1 0 ) ; 
 
                                 / / 
 
                                 / /             O r   a   r a n g e   f r o m   2 0 0 4 - D e c - 2 5   t o   2 0 0 5 - J a n - 0 1 : 
 
                                 / / 
 
                                 / /                     c a l . d a t e s [ 1 ]   = 
 
                                 / /                             [ n e w   D a t e ( 2 0 0 4 , 1 1 , 2 5 ) , n e w   D a t e ( 2 0 0 5 , 0 , 1 ) ] ; 
 
                                 / / 
 
                                 / /             T h e   f o l l o w i n g   w i l l   s p e c i f y   a l l   c a l e n d a r   d a t e s   u p   t o 
 
                                 / /             y e s t e r d a y : 
 
                                 / / 
 
                                 / /                     c a l . d a t e s [ 2 ]   = 
 
                                 / /                             [ n e w   D a t e ( c a l . b a s e Y e a r , 0 , 1 ) , 
 
                                 / /                               n e w   D a t e ( d a t e N o w . g e t F u l l Y e a r ( ) , 
 
                                 / /                                                 d a t e N o w . g e t M o n t h ( ) , 
 
                                 / /                                                 d a t e N o w . g e t D a t e ( ) - 1 ) ] ; 
 
                                 / / 
 
                                 / /   R e m e m b e r   t h a t   J a v a s c r i p t   m o n t h s   a r e   z e r o - b a s e d . 
 
 
 
                                 / /   A l l o w   s p e c i f i e d   d a t e s   t o   b e   h i g h l i g h t e d   w h e n   t h e y   a r e   e n a b l e d . 
 
                                 / /   Y o u   c a n   s e t   i n d i v i d u a l   d a t e s   o r   d a t e   r a n g e s   i n   t h e   s a m e   w a y   a s 
 
                                 / /   a b o v e . 
 
 
 
                                 c a l . h i g h l i g h t D a t e s   =   n e w   A r r a y ( ) ; 
 
 
 
                                 / /   D a t e s   t h a t   a r e   o u t   o f   t h e   s p e c i f i e d   r a n g e   c a n   b e   d i s p l a y e d   a t 
 
                                 / /   t h e   s t a r t   o f   t h e   v e r y   f i r s t   m o n t h   a n d   e n d   o f   t h e   v e r y   l a s t . 
 
                                 / /   S e t   o u t O f R a n g e D i s a b l e   =   t r u e   t o   d i s a b l e   t h e s e   d a t e s 
 
                                 / /   ( o r   f a l s e   t o   a l l o w   t h e i r   s e l e c t i o n ) . 
 
 
 
                                 c a l . o u t O f R a n g e D i s a b l e   =   t r u e ; 
 
 
 
                                 / /   D a t e s   t h a t   a r e   o u t   o f   t h e   d i s p l a y e d   m o n t h   a r e   s h o w n   a t   t h e   s t a r t 
 
                                 / /   ( u n l e s s   t h e   m o n t h   s t a r t s   o n   t h e   f i r s t   d a y   o f   t h e   w e e k )   a n d   e n d   o f 
 
                                 / /   e a c h   m o n t h .   S e t   o u t O f M o n t h D i s a b l e   =   t r u e   t o   d i s a b l e   t h e s e   d a t e s 
 
                                 / /   ( o r   f a l s e   t o   a l l o w   t h e i r   s e l e c t i o n ) .   S e t   o u t O f M o n t h H i d e   =   t r u e 
 
                                 / /   t o   h i d e   t h e s e   d a t e s   ( o r   f a l s e   t o   m a k e   t h e m   v i s i b l e ) . 
 
 
 
                                 c a l . o u t O f M o n t h D i s a b l e   =   f a l s e ; 
 
                                 c a l . o u t O f M o n t h H i d e         =   f a l s e ; 
 
 
 
                                 / /   I f   y o u   w a n t   a   s p e c i a l   f o r m a t   f o r   t h e   c e l l   t h a t   c o n t a i n s   t h e   c u r r e n t   d a y 
 
                                 / /   s e t   t h i s   t o   t r u e .     T h i s   s e t s   a   t h i n   b o r d e r   a r o u n d   t h e   c e l l   i n   t h e   c o l o u r 
 
                                 / /   s e t   b y   c a l . t o d a y C e l l B o r d e r C o l o u r . 
 
 
 
                                 c a l . f o r m a t T o d a y C e l l   =   t r u e ; 
 
                                 c a l . t o d a y C e l l B o r d e r C o l o u r   =   ' # f 0 0 ' ;   / /   r e d 
 
 
 
                                 / /   Y o u   c a n   a l l o w   t h e   c a l e n d a r   t o   b e   d r a g g e d   a r o u n d   t h e   s c r e e n   b y 
 
                                 / /   u s i n g   t h e   s e t t i n g   a l l o w D r a g   =   t r u e . 
 
                                 / /   I   c a n ' t   s a y   I   r e c o m m e n d   i t   b e c a u s e   o f   t h e   d a n g e r   o f   t h e   u s e r 
 
                                 / /   f o r g e t t i n g   w h i c h   d a t e   f i e l d   t h e   c a l e n d a r   w i l l   u p d a t e   w h e n 
 
                                 / /   t h e r e   a r e   m u l t i p l e   d a t e   f i e l d s   o n   a   p a g e . 
 
 
 
                                 c a l . a l l o w D r a g   =   f a l s e ; 
 
 
 
                                 / /   I t   i s   n o t   e a s y   t o   c o d e   H T M L   e v e n t s   t o   m a k e   t h e   f o c u s   m o v e 
 
                                 / /   a u t o m a t i c a l l y   o n   t o   t h e   n e x t   e l e m e n t   i n   t h e   t a b   o r d e r   s o 
 
                                 / /   h e r e   i s   a   p a r a m e t e r   y o u   c a n   s e t   t h a t   w i l l   t e l l   t h e   s c r i p t 
 
                                 / /   t o   d o   i t   f o r   y o u .     N O T E :   T h e   s c r i p t   m a y   h a v e   t o   b u i l d   a   l i s t 
 
                                 / /   o f   a l l   t h e   p a g e ' s   e l e m e n t s   i n   t a b I n d e x   o r d e r   t o   a c h i e v e   t h i s 
 
                                 / /   s o   t h e r e   c a n   b e   a n   o v e r h e a d   t o   u s i n g   t h i s   f e a t u r e . 
 
 
 
                                 c a l . o n B l u r M o v e N e x t   =   f a l s e ; 
 
 
 
                                 / /   Y o u   c a n   a l l o w   a   c l i c k   o n   t h e   c a l e n d a r   t o   c l o s e   d y n a m i c 
 
                                 / /   c a l e n d a r s   b y   s e t t i n g   c l i c k T o H i d e   =   t r u e .     I f   s e t   t o   f a l s e 
 
                                 / /   t h e   s c r i p t   w i l l   h i d e   a   d y n a m i c   c a l e n d a r   w h e n   a   d a t e   i s 
 
                                 / /   s e l e c t e d   o r   t h e   m a i n   p a g e   i s   c l i c k e d . 
 
 
 
                                 c a l . c l i c k T o H i d e   =   f a l s e ; 
 
 
 
                                 / /   D y n a m i c   c a l e n d a r   p o s i t i o n i n g   i s   r e l a t i v e   t o   t h e   r e t u r n   v a l u e 
 
                                 / /   e l e m e n t .   T h e   s c r i p t   i s   s u p p l i e d   w i t h   t h e   p a r a m e t e r s   b e l o w 
 
                                 / /   s e t t i n g   t h e   c a l e n d a r ' s   t o p   l e f t   c o r n e r   t o   a p p e a r   a t   t h e 
 
                                 / /   r e t u r n   e l e m e n t ' s   b o t t o m   l e f t   c o r n e r . 
 
 
 
                                 / / c a l . x B a s e           =   ' L ' ; 
 
                                 c a l . x B a s e           =     _ x B a s e ? _ x B a s e : ' L ' ; 
 
                                 c a l . y B a s e           =   ' B ' ; 
 
                                 c a l . x P o s i t i o n   =   ' L ' ; 
 
                                 c a l . y P o s i t i o n   =   ' T ' ; 
 
 
 
                                 / /   F o r   t h e   h o r i z o n t a l   ( X )   p a r a m e t e r s ,   x B a s e   a n d   x P o s i t i o n , 
 
                                 / /   t h e   a c c e p t e d   v a l u e s   a r e ;     L   -   L e f t 
 
                                 / /                                                       M   -   M i d d l e 
 
                                 / /                                                       R   -   R i g h t 
 
                                 / /                                             o r     n n   -   i n t e g e r   p i x e l   o f f s e t   f r o m   l e f t   + / - 
 
                                 / / 
 
                                 / /   F o r   t h e   v e r t i c a l   ( Y )   p a r a m e t e r s ,   y B a s e   a n d   y P o s i t i o n , 
 
                                 / /   t h e   a c c e p t e d   v a l u e s   a r e ;     T   -   T o p 
 
                                 / /                                                       M   -   M i d d l e 
 
                                 / /                                                       B   -   B o t t o m 
 
                                 / /                                             o r     n n   -   i n t e g e r   p i x e l   o f f s e t   f r o m   t o p   + / - 
 
 
 
                                 / /   T h e   c a l e n d a r   w i l l   p o s i t i o n   i t s e l f   a l i g n e d   a c c o r d i n g   t o   t h e 
 
                                 / /   c h o i c e s   a b o v e .     I f   a u t o m a t i c   p o s i t i o n i n g   i s   t u r n e d 
 
                                 / /   o n     w i t h     c a l . a u t o P o s i t i o n   =   t r u e     t h e n   i f   t h e   c h o s e n   p o s i t i o n 
 
                                 / /   w o u l d   c a u s e   t h e   c a l e n d a r   t o   d i s p l a y   o f f   t h e   v i s i b l e   s c r e e n , 
 
                                 / /   i t   i s   s h i f t e d   t o   a   p o s i t i o n   t h a t   i s   v i s i b l e . 
 
 
 
                                 c a l . a u t o P o s i t i o n   =   t r u e ; 
 
 
 
                         } 
 
 
 
                         / /   D o   n o t   s e t   t h e   v a l u e   o f   t h i s   c a l e n d a r   a t t r i b u t e .     I t   i s   u s e d 
 
                         / /   t o   t e l l   y o u   w h e t h e r   a   d a t e   h a s   b e e n   s e l e c t e d   o r   n o t   w h e n 
 
                         / /   u s i n g   t h e   J A C S . n e x t   f e a t u r e   t o   t r i g g e r   a   f u n c t i o n   a f t e r   t h e 
 
                         / /   c a l e n d a r   i s   u s e d . 
 
                         / /   d a t e R e t u r n e d   i s   F a l s e   u n l e s s   t h e   u s e r   h a s   c l i c k e d   o n   a n 
 
                         / /   a c t i v e   d a t e   c e l l   o r   t h e   v a l u e   f o r   " T o d a y " ,   i n   w h i c h   c a s e 
 
                         / /   i t   i s   T r u e . 
 
 
 
                         c a l . d a t e R e t u r n e d     =   f a l s e ; 
 
 
 
                         / /   T h e   m o s t   r e c e n t   d a t e   o u t p u t   t o   t h e   t a r g e t   e l e m e n t   i s   s t o r e d 
 
                         / /   a s   a n   a t t r i b u t e   o f   t h e   c a l e n d a r .   I n i t i a l i s e d   t o   M i d n i g h t 
 
                         / /   o n   1 s t   J a n u a r y   1 9 7 0   ( U T C ) ,   a   s e l e c t e d   d a t e   c a n   n e v e r 
 
                         / /   e q u a l   t h i s   b e c a u s e   r e t u r n e d   d a t e s   a r e   a l w a y s   1 2   M i d d a y . 
 
 
 
                         c a l . o u t p u t D a t e         =   n e w   D a t e ( 0 ) ; 
 
 
 
                         / /   F i n a l l y :   T h e   f o l l o w i n g   a t t r i b u t e s   a r e   u s e d   i n   c a l e n d a r 
 
                         / /                     f u n c t i o n s .     Y o u   n e e d   d o   n o t h i n g   w i t h   t h e m   h e r e . 
 
 
 
                         c a l . s e e d D a t e             =   n e w   D a t e ( ) ; 
 
                         c a l . f u l l I n p u t D a t e   =   f a l s e ; 
 
                         c a l . a c t i v e T o d a y       =   t r u e ; 
 
                         c a l . m o n t h S u m             =   0 ; 
 
                         c a l . d a y s                     =   n e w   A r r a y ( ) ; 
 
                         c a l . a r r O n N e x t           =   n e w   A r r a y ( ) ; 
 
                         c a l . t r i g g e r E l e ; 
 
                         c a l . t a r g e t E l e ; 
 
                 } ; 
 
 
 
 / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 / /   E n d   o f   c u s t o m i s a t i o n   s e c t i o n 
 
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 
 
 / /   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 / /   C u s t o m   m e t h o d s   f o r   D a t e ,   S t r i n g   a n d   F u n c t i o n   p r o t o t y p e s 
 
 / /   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 
 
           / /   F o r m a t   a   d a t e   i n t o   t h e   r e q u i r e d   p a t t e r n 
 
 
 
           D a t e . p r o t o t y p e . j a c s F o r m a t   = 
 
                 f u n c t i o n ( f o r m a t , m o n t h N a m e s ) 
 
                         { v a r   c h a r C o u n t   =   0 , 
 
                                   c o d e C h a r     =   ' ' , 
 
                                   r e s u l t         =   ' ' ; 
 
 
 
                           f o r   ( v a r   i = 0 ; i < = f o r m a t . l e n g t h ; i + + ) 
 
                                 { i f   ( i < f o r m a t . l e n g t h   & &   f o r m a t . c h a r A t ( i ) = = c o d e C h a r ) 
 
                                                 { / /   I f   w e   h a v e n ' t   h i t   t h e   e n d   o f   t h e   s t r i n g   a n d 
 
                                                   / /   t h e   f o r m a t   s t r i n g   c h a r a c t e r   i s   t h e   s a m e   a s 
 
                                                   / /   t h e   p r e v i o u s   o n e ,   j u s t   c l o c k   u p   o n e   t o   t h e 
 
                                                   / /   l e n g t h   o f   t h e   c u r r e n t   e l e m e n t   d e f i n i t i o n 
 
                                                   c h a r C o u n t + + ; 
 
                                                 } 
 
                                   e l s e       { s w i t c h   ( c o d e C h a r ) 
 
                                                         { c a s e   ' y ' :   c a s e   ' Y ' : 
 
                                                                 r e s u l t   + =   ( t h i s . g e t F u l l Y e a r ( ) % M a t h . p o w ( 1 0 , c h a r C o u n t ) ) . t o S t r i n g ( ) . j a c s P a d L e f t ( c h a r C o u n t ) ; 
 
                                                                 b r e a k ; 
 
                                                           c a s e   ' m ' :   c a s e   ' M ' : 
 
                                                                 / /   I f   w e   f i n d   a n   M ,   c h e c k   t h e   n u m b e r   o f   t h e m   t o 
 
                                                                 / /   d e t e r m i n e   w h e t h e r   t o   g e t   t h e   m o n t h   n u m b e r   o r 
 
                                                                 / /   t h e   m o n t h   n a m e . 
 
                                                                 r e s u l t   + =   ( c h a r C o u n t < 3 ) 
 
                                                                                         ? ( t h i s . g e t M o n t h ( ) + 1 ) . t o S t r i n g ( ) . j a c s P a d L e f t ( c h a r C o u n t ) 
 
                                                                                         : m o n t h N a m e s [ t h i s . g e t M o n t h ( ) ] ; 
 
                                                                 b r e a k ; 
 
                                                           c a s e   ' d ' :   c a s e   ' D ' : 
 
                                                                 / /   I f   w e   f i n d   a   D ,   g e t   t h e   d a t e   a n d   f o r m a t   i t 
 
                                                                 r e s u l t   + =   t h i s . g e t D a t e ( ) . t o S t r i n g ( ) . j a c s P a d L e f t ( c h a r C o u n t ) ; 
 
                                                                 b r e a k ; 
 
                                                           d e f a u l t : 
 
                                                                 / /   C o p y   a n y   u n r e c o g n i s e d   c h a r a c t e r s   a c r o s s 
 
                                                                 w h i l e   ( c h a r C o u n t - - > 0 )   { r e s u l t   + =   c o d e C h a r ; } 
 
                                                         } 
 
 
 
                                                   i f   ( i < f o r m a t . l e n g t h ) 
 
                                                         { / /   S t o r e   t h e   c h a r a c t e r   w e   h a v e   j u s t   w o r k e d   o n 
 
                                                           c o d e C h a r     =   f o r m a t . c h a r A t ( i ) ; 
 
                                                           c h a r C o u n t   =   1 ; 
 
                                                         } 
 
                                                 } 
 
                                 } 
 
                           r e t u r n   r e s u l t ; 
 
                         } ; 
 
 
 
           / /   L e f t   p a d   z e r o e s 
 
 
 
           S t r i n g . p r o t o t y p e . j a c s P a d L e f t   = 
 
                 f u n c t i o n ( p a d T o L e n g t h ) 
 
                         { v a r   r e s u l t   =   ' ' ; 
 
                           f o r   ( v a r   i = 0 ; i < ( p a d T o L e n g t h - t h i s . l e n g t h ) ; i + + )   { r e s u l t   + =   ' 0 ' } ; 
 
                           r e t u r n   ( r e s u l t + t h i s ) ; 
 
                         } ; 
 
 
 
           / /   S e t   u p   a   c l o s u r e   s o   t h a t   a n y   n e x t   f u n c t i o n   c a n   b e   t r i g g e r e d   a f t e r   t h e   c a l e n d a r 
 
           / /   h a s   b e e n   c l o s e d   A N D   t h a t   f u n c t i o n   c a n   t a k e   a r g u m e n t s . 
 
 
 
           F u n c t i o n . p r o t o t y p e . j a c s R u n N e x t   = 
 
                 f u n c t i o n ( )     { v a r   f u n c   =   t h i s ,   a r g s   =   a r g u m e n t s [ 0 ] ; 
 
                                           f u n c . J A C S i d   =   a r g u m e n t s [ 1 ] ; 
 
                                           r e t u r n   f u n c t i o n ( )   { r e t u r n   f u n c . a p p l y ( t h i s ,   a r g s ) ; } ; 
 
                                         } ; 
 
 
 
 / /   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 / /   S e t   u p   c a l e n d a r   e v e n t s   o n   c a l l i n g   p a g e 
 
 / /   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 
 
           i f   ( d o c u m e n t . a d d E v e n t L i s t e n e r ) 
 
                     { w i n d o w . a d d E v e n t L i s t e n e r (     ' l o a d ' , j a c s L o a d e r , t r u e ) ; } 
 
           e l s e   { w i n d o w . a t t a c h E v e n t           ( ' o n l o a d ' , j a c s L o a d e r ) ; } 
 
 
 
           f u n c t i o n   j a c s L o a d e r ( ) 
 
                 { / /   D e f i n e   d o c u m e n t   l e v e l   e v e n t   t o   h i d e   t h e   c a l e n d a r   o n   c l i c k . 
 
 
 
                   i f   ( d o c u m e n t . a d d E v e n t L i s t e n e r ) 
 
                             { d o c u m e n t . a d d E v e n t L i s t e n e r ( ' c l i c k ' , h i d e ,   f a l s e ) ; } 
 
                   e l s e   { d o c u m e n t . a t t a c h E v e n t ( ' o n c l i c k ' , h i d e ) ; } 
 
 
 
                   / /   C r e a t e   a n   o n B e f o r e U n l o a d   e v e n t   t o   h a n d l e   I E   m e m o r y   l e a k s . 
 
 
 
                   i f   ( g e t E l ( ' j a c s I E l t 7 ' ) )   { w i n d o w . a t t a c h E v e n t ( ' o n b e f o r e u n l o a d ' , d e f e a t L e a k s ) ; } 
 
 
 
                   f u n c t i o n   d e f e a t L e a k s ( ) 
 
                         { f o r   ( v a r   i = 0 ; i < c a l s . l e n g t h ; i + + ) 
 
                                 { / /   D i s p l a y   t h e   w e e k   n u m b e r   c o l u m n   ( h e a d e r   a n d   r o w   n u m b e r s ) . 
 
                                   g e t E l ( c a l s [ i ] + ' W e e k _ ' ) . s t y l e . d i s p l a y = ' ' ; 
 
 
 
                                   f o r   ( v a r   j = 0 ; j < 6 ; j + + )   { g e t E l ( c a l s [ i ] + ' W e e k _ ' + j ) . s t y l e . d i s p l a y = ' ' ; } 
 
 
 
                                   / /   S e t   e v e n t s   t o   n u l l . 
 
 
 
                                   g e t E l ( c a l s [ i ] + ' N o w ' ) . o n c l i c k                   =   n u l l ; 
 
                                   g e t E l ( c a l s [ i ] + ' N o w ' ) . o n m o u s e o v e r           =   n u l l ; 
 
                                   g e t E l ( c a l s [ i ] + ' N o w ' ) . o n m o u s e o u t             =   n u l l ; 
 
                                   g e t E l ( c a l s [ i ] + ' C l e a r B u t t o n ' ) . o n c l i c k   =   n u l l ; 
 
 
 
                                   v a r   c a l         =   g e t E l ( c a l s [ i ] ) , 
 
                                           c e l l s     =   g e t E l ( c a l s [ i ] + ' C e l l s ' ) . c h i l d N o d e s ; 
 
 
 
                                   f o r   ( v a r   j = 0 ; j < c e l l s . l e n g t h ; j + + ) 
 
                                         { v a r   r o w s   =   c e l l s [ j ] . c h i l d N o d e s ; 
 
                                           f o r   ( v a r   k = 1 ; k < r o w s . l e n g t h ; k + + ) 
 
                                                 { r o w s [ k ] . o n c l i c k           =   n u l l ; 
 
                                                   r o w s [ k ] . o n m o u s e o v e r   =   n u l l ; 
 
                                                   r o w s [ k ] . o n m o u s e o u t     =   n u l l ; 
 
                                                 } 
 
                                         } 
 
 
 
                                   / /   S e t   c a l e n d a r ' s   l e a k y   c u s t o m   a t t r i b u t e s   t o   n u l l . 
 
 
 
                                   c a l . a r r O n N e x t     =   n u l l ; 
 
                                   c a l . t a r g e t E l e     =   n u l l ; 
 
                                 } 
 
                         } ; 
 
                 } ; 
 
 
 
 / /   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 / /   S t a r t   o f   M a i n   P r i v a t e   F u n c t i o n   L i b r a r y 
 
 / /   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 
 
           f u n c t i o n   s h o w M o n t h ( b i a s , c a l I d ) 
 
                 { / /   S e t   t h e   s e l e c t a b l e   M o n t h   a n d   Y e a r 
 
                   / /   M a y   b e   c a l l e d :   f r o m   t h e   l e f t   a n d   r i g h t   a r r o w s 
 
                   / /                                     ( s h i f t   m o n t h   - 1   a n d   + 1   r e s p e c t i v e l y ) 
 
                   / /                                 f r o m   t h e   m o n t h   s e l e c t i o n   l i s t 
 
                   / /                                 f r o m   t h e   y e a r   s e l e c t i o n   l i s t 
 
                   / /                                 f r o m   t h e   s h o w C a l   r o u t i n e 
 
                   / /                                     ( w h i c h   i n i t i a t e s   t h e   d i s p l a y ) . 
 
                   v a r   c a l               =   g e t E l ( c a l I d ) , 
 
                           s h o w D a t e     =   n e w   D a t e ( D a t e . p a r s e ( n e w   D a t e ( ) . t o D a t e S t r i n g ( ) ) ) , 
 
                           s t a r t D a t e   =   n e w   D a t e ( ) ; 
 
 
 
                   / /   S e t   t h e   t i m e   t o   t h e   m i d d l e   o f   t h e   d a y   s o   t h a t   t h e   h a n d f u l   o f 
 
                   / /   r e g i o n s   t h a t   h a v e   d a y l i g h t   s a v i n g   s h i f t s   t h a t   c h a n g e   t h e   d a y 
 
                   / /   o f   t h e   m o n t h   ( i . e .   t u r n   t h e   c l o c k   b a c k   a t   m i d n i g h t   o r   f o r w a r d 
 
                   / /   a t   2 3 : 0 0 )   d o   n o t   m e s s   u p   t h e   d a t e   d i s p l a y   i n   t h e   c a l e n d a r . 
 
 
 
                   s h o w D a t e . s e t H o u r s ( 1 2 ) ; 
 
 
 
                   s e l Y e a r s     =   g e t E l ( c a l I d + ' Y e a r s ' ) ; 
 
                   s e l M o n t h s   =   g e t E l ( c a l I d + ' M o n t h s ' ) ; 
 
 
 
                   i f   (   s e l Y e a r s . o p t i o n s . s e l e c t e d I n d e x > - 1 )   { c a l . m o n t h S u m   = 1 2 * ( s e l Y e a r s . o p t i o n s . s e l e c t e d I n d e x ) + b i a s ; } 
 
                   i f   ( s e l M o n t h s . o p t i o n s . s e l e c t e d I n d e x > - 1 )   { c a l . m o n t h S u m + = s e l M o n t h s . o p t i o n s . s e l e c t e d I n d e x ; } 
 
 
 
                   s h o w D a t e . s e t F u l l Y e a r ( c a l . b a s e Y e a r + M a t h . f l o o r ( c a l . m o n t h S u m / 1 2 ) , ( c a l . m o n t h S u m % 1 2 ) , 1 ) ; 
 
 
 
                   / /   I f   t h e   W e e k   n u m b e r s   a r e   d i s p l a y e d ,   s h i f t   t h e   w e e k   d a y   n a m e s   t o   t h e   r i g h t . 
 
 
 
                   g e t E l ( c a l I d + ' W e e k _ ' ) . s t y l e . d i s p l a y   =   ( c a l . w e e k N u m b e r D i s p l a y ) ? ' ' : ' n o n e ' ; 
 
 
 
                   / /   O p e r a   h a s   a   b u g   w i t h   s e t t i n g   t h e   s e l e c t e d   i n d e x . 
 
                   / /   I t   r e q u i r e s   t h e   f o l l o w i n g   w o r k - a r o u n d   t o   f o r c e   S E L E C T s   t o   d i s p l a y   c o r r e c t l y . 
 
                   i f   ( w i n d o w . o p e r a ) 
 
                         { s e l M o n t h s . s t y l e . d i s p l a y   =   ' i n h e r i t ' ; 
 
                             s e l Y e a r s . s t y l e . d i s p l a y   =   ' i n h e r i t ' ; 
 
                         } 
 
 
 
                   t m p   =   ( 1 2 * p a r s e I n t ( ( s h o w D a t e . g e t F u l l Y e a r ( ) - c a l . b a s e Y e a r ) , 1 0 ) )   +   p a r s e I n t ( s h o w D a t e . g e t M o n t h ( ) , 1 0 ) ; 
 
 
 
                   i f   ( t m p   >   - 1   & &   t m p   <   ( 1 2 * c a l . d r o p D o w n Y e a r s ) ) 
 
                         { s e l Y e a r s . o p t i o n s . s e l e c t e d I n d e x     =   M a t h . f l o o r ( c a l . m o n t h S u m / 1 2 ) ; 
 
                           s e l M o n t h s . o p t i o n s . s e l e c t e d I n d e x   =   ( c a l . m o n t h S u m % 1 2 ) ; 
 
 
 
                           c u r M o n t h   =   s h o w D a t e . g e t M o n t h ( ) ; 
 
 
 
                           s h o w D a t e . s e t D a t e ( ( ( ( s h o w D a t e . g e t D a y ( ) - c a l . w e e k S t a r t ) < 0 ) ? - 6 : 1 ) + c a l . w e e k S t a r t - s h o w D a t e . g e t D a y ( ) ) ; 
 
 
 
                           v a r   c o m p a r e D a t e V a l u e   =   n e w   D a t e ( s h o w D a t e . g e t F u l l Y e a r ( ) , s h o w D a t e . g e t M o n t h ( ) , s h o w D a t e . g e t D a t e ( ) ) . v a l u e O f ( ) ; 
 
 
 
                           s t a r t D a t e   =   n e w   D a t e ( s h o w D a t e ) ; 
 
 
 
                           v a r   n o w   =   g e t E l ( c a l I d + ' N o w ' ) ; 
 
 
 
                           f u n c t i o n   n o w O u t p u t ( )   { s e t O u t p u t ( d a t e N o w , c a l I d ) ; } ; 
 
 
 
                           i f   ( c a l . d a t e s . l e n g t h = = 0 ) 
 
                                 { i f   ( c a l . a c t i v e   & &   c a l . a c t i v e T o d a y ) 
 
                                         { n o w . o n c l i c k       =   n o w O u t p u t ; 
 
                                           n o w . c l a s s N a m e   =   ' j a c s N o w ' ; 
 
 
 
                                           i f   ( g e t E l ( ' j a c s I E ' ) ) 
 
                                                 { n o w . o n m o u s e o v e r   =   c h a n g e C l a s s ; 
 
                                                   n o w . o n m o u s e o u t     =   c h a n g e C l a s s ; 
 
                                                 } 
 
 
 
                                           i f   ( d o c u m e n t . r e m o v e E v e n t L i s t e n e r ) 
 
                                                         { n o w . r e m o v e E v e n t L i s t e n e r ( ' c l i c k ' , s t o p P r o p a g a t i o n , f a l s e ) ; } 
 
                                           e l s e       { n o w . d e t a c h E v e n t (             ' o n c l i c k ' , s t o p P r o p a g a t i o n ) ; } 
 
                                         } 
 
                                   e l s e 
 
                                         { n o w . o n c l i c k       =   n u l l ; 
 
                                           n o w . c l a s s N a m e   =   ' j a c s N o w D i s a b l e d ' ; 
 
 
 
                                           i f   ( g e t E l ( ' j a c s I E ' ) ) 
 
                                                 { n o w . o n m o u s e o v e r   =   n u l l ; 
 
                                                   n o w . o n m o u s e o u t     =   n u l l ; 
 
                                                 } 
 
 
 
                                           i f   ( d o c u m e n t . a d d E v e n t L i s t e n e r ) 
 
                                                         { n o w . a d d E v e n t L i s t e n e r ( ' c l i c k ' , s t o p P r o p a g a t i o n , f a l s e ) ; } 
 
                                           e l s e       { n o w . a t t a c h E v e n t (       ' o n c l i c k ' , s t o p P r o p a g a t i o n ) ; } 
 
                                         } 
 
                                 } 
 
                           e l s e 
 
                                 { f o r   ( v a r   k = 0 ; k < c a l . d a t e s . l e n g t h ; k + + ) 
 
                                         { i f   ( ! c a l . a c t i v e T o d a y   | | 
 
                                                   ( t y p e o f   c a l . d a t e s [ k ] = = ' o b j e c t '   & & 
 
                                                             ( ( c a l . d a t e s [ k ] . c o n s t r u c t o r = = D a t e     & &   d a t e N o w . v a l u e O f ( )   = =   c a l . d a t e s [ k ] . v a l u e O f ( ) )   | | 
 
                                                               ( c a l . d a t e s [ k ] . c o n s t r u c t o r = = A r r a y   & &   d a t e N o w . v a l u e O f ( )   > =   c a l . d a t e s [ k ] [ 0 ] . v a l u e O f ( )   & & 
 
                                                                                                                                       d a t e N o w . v a l u e O f ( )   < =   c a l . d a t e s [ k ] [ 1 ] . v a l u e O f ( ) 
 
                                                               ) 
 
                                                             ) 
 
                                                   ) 
 
                                                 ) 
 
                                                 { n o w . o n c l i c k       =   ( c a l . a c t i v e   & &   c a l . v a l u e s E n a b l e d ) ? n o w O u t p u t : n u l l ; 
 
                                                   n o w . c l a s s N a m e   =   ( c a l . a c t i v e   & &   c a l . v a l u e s E n a b l e d ) ? ' j a c s N o w ' : ' j a c s N o w D i s a b l e d ' ; 
 
 
 
                                                   i f   ( g e t E l ( ' j a c s I E ' ) ) 
 
                                                         { n o w . o n m o u s e o v e r   =   ( c a l . a c t i v e   & &   c a l . v a l u e s E n a b l e d ) ? c h a n g e C l a s s : n u l l ; 
 
                                                           n o w . o n m o u s e o u t     =   ( c a l . a c t i v e   & &   c a l . v a l u e s E n a b l e d ) ? c h a n g e C l a s s : n u l l ; 
 
                                                         } 
 
 
 
                                                   i f   ( c a l . a c t i v e   & &   c a l . v a l u e s E n a b l e d ) 
 
                                                         { i f   ( d o c u m e n t . r e m o v e E v e n t L i s t e n e r )   { n o w . r e m o v e E v e n t L i s t e n e r ( ' c l i c k ' , s t o p P r o p a g a t i o n , f a l s e ) ; } 
 
                                                           e l s e                                                             { n o w . d e t a c h E v e n t (             ' o n c l i c k ' , s t o p P r o p a g a t i o n ) ; } 
 
                                                         } 
 
                                                   e l s e 
 
                                                         { i f   ( d o c u m e n t . a d d E v e n t L i s t e n e r )   { n o w . a d d E v e n t L i s t e n e r ( ' c l i c k ' , s t o p P r o p a g a t i o n , f a l s e ) ; } 
 
                                                           e l s e                                                       { n o w . a t t a c h E v e n t (       ' o n c l i c k ' , s t o p P r o p a g a t i o n ) ; } 
 
                                                         } 
 
 
 
                                                   b r e a k ; 
 
                                                 } 
 
                                           e l s e 
 
                                                 { n o w . o n c l i c k       =   ( c a l . a c t i v e   & &   c a l . v a l u e s E n a b l e d ) ? n u l l : n o w O u t p u t ; 
 
                                                   n o w . c l a s s N a m e   =   ( c a l . a c t i v e   & &   c a l . v a l u e s E n a b l e d ) ? ' j a c s N o w D i s a b l e d ' : ' j a c s N o w ' ; 
 
 
 
                                                   i f   ( g e t E l ( ' j a c s I E ' ) ) 
 
                                                         { n o w . o n m o u s e o v e r   =   ( c a l . a c t i v e   & &   c a l . v a l u e s E n a b l e d ) ? n u l l : c h a n g e C l a s s ; 
 
                                                           n o w . o n m o u s e o u t     =   ( c a l . a c t i v e   & &   c a l . v a l u e s E n a b l e d ) ? n u l l : c h a n g e C l a s s ; 
 
                                                         } 
 
 
 
                                                   i f   ( c a l . a c t i v e   & &   c a l . v a l u e s E n a b l e d ) 
 
                                                         { i f   ( d o c u m e n t . a d d E v e n t L i s t e n e r )   { n o w . a d d E v e n t L i s t e n e r ( ' c l i c k ' , s t o p P r o p a g a t i o n , f a l s e ) ; } 
 
                                                           e l s e                                                       { n o w . a t t a c h E v e n t (       ' o n c l i c k ' , s t o p P r o p a g a t i o n ) ; } 
 
                                                         } 
 
                                                   e l s e 
 
                                                         { i f   ( d o c u m e n t . r e m o v e E v e n t L i s t e n e r )   { n o w . r e m o v e E v e n t L i s t e n e r ( ' c l i c k ' , s t o p P r o p a g a t i o n , f a l s e ) ; } 
 
                                                           e l s e                                                             { n o w . d e t a c h E v e n t (             ' o n c l i c k ' , s t o p P r o p a g a t i o n ) ; } 
 
                                                         } 
 
                                                 } 
 
                                         } 
 
                                 } 
 
 
 
                           f u n c t i o n   s e t O u t p u t ( o u t p u t D a t e , c a l I d ) 
 
                                 { v a r   c a l   =   g e t E l ( c a l I d ) ; 
 
 
 
                                   i f   ( t y p e o f   c a l . t a r g e t E l e . v a l u e   = =   ' u n d e f i n e d ' ) 
 
                                                 { c a l . t r i g g e r E l e . t e x t N o d e . r e p l a c e D a t a ( 0 , c a l . t r i g g e r E l e . l e n , o u t p u t D a t e . j a c s F o r m a t ( c a l . d a t e F o r m a t , c a l . m o n t h N a m e s ) ) ; } 
 
                                   e l s e       { c a l . e l e . v a l u e   =   o u t p u t D a t e . j a c s F o r m a t ( c a l . d a t e F o r m a t , c a l . m o n t h N a m e s ) ; } 
 
 
 
                                   c a l . d a t e R e t u r n e d   =   t r u e ; 
 
                                   c a l . o u t p u t D a t e       =   o u t p u t D a t e ; 
 
 
 
                                   i f   ( c a l . d y n a m i c )   { h i d e ( c a l I d ) ; } 
 
                                   e l s e   { i f   ( t y p e o f   c a l . o n N e x t ! = ' u n d e f i n e d '   & &   c a l . o n N e x t ! = n u l l )   { c a l . o n N e x t ( ) ; } 
 
                                               J A C S . s h o w ( c a l . e l e , c a l . i d , c a l . d a y s ) ; 
 
                                             } 
 
 
 
                                   i f   ( c a l . o n B l u r M o v e N e x t ) 
 
                                         { / /   i f   t h e   t a r g e t   e l e m e n t   h a s   a   t a b I n d e x   l o o k   f o r   t a b I n d e x + 1 
 
                                           / /   i f   t h a t   e x i s t s   t h e n   s e t   t h e   f o c u s   t o   i t 
 
 
 
                                           v a r   t a g s T o F i n d   =   ' I N P U T ; A ; S E L E C T ; T E X T A R E A ; B U T T O N ; A R E A ; O B J E C T ' , 
 
                                                   f o u n d             =   f a l s e ; 
 
 
 
                                           i f   ( c a l . e l e . t a b I n d e x > 0 ) 
 
                                                 { v a r   t a g s   =   t a g s T o F i n d . s p l i t ( ' ; ' ) ; 
 
 
 
                                                   t a g s O u t e r L o o p : 
 
                                                   f o r   ( v a r   i = 0 ; t a g s . l e n g t h ; i + + ) 
 
                                                         { e l e m e n t s B y T a g   =   d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( t a g s [ i ] ) ; 
 
 
 
                                                           f o r   ( v a r   j = 0 ; j < e l e m e n t s B y T a g . l e n g t h ; j + + ) 
 
                                                                 { i f   ( e l e m e n t s B y T a g [ j ] . t a b I n d e x = = ( c a l . e l e . t a b I n d e x + 1 )   & &   ! e l e m e n t s B y T a g [ j ] . d i s a b l e d   & & 
 
                                                                           e l e m e n t s B y T a g [ j ] . t y p e ! = ' h i d d e n '   & &   e l e m e n t s B y T a g [ j ] . s t y l e . d i s p l a y ! = ' n o n e '   & & 
 
                                                                           e l e m e n t s B y T a g [ j ] . s t y l e . v i s i b i l i t y ! = ' h i d d e n ' ) 
 
                                                                         { e l e m e n t s B y T a g [ j ] . f o c u s ( ) ; 
 
                                                                           f o u n d   =   t r u e ; 
 
                                                                           b r e a k   t a g s O u t e r L o o p ; 
 
                                                                         } 
 
                                                                 } 
 
                                                         } 
 
                                                 } 
 
 
 
                                           / /   e l s e   d o   t h e   f u l l   s e a r c h   t o   f i n d   t h e   n e x t   e l e m e n t 
 
 
 
                                           i f   ( ! f o u n d ) 
 
                                                 { / /   f i n d   e l e m e n t   t a b I n d i c e s 
 
                                                   f u n c t i o n   o r d e r E l e m e n t s ( ) 
 
                                                         { v a r   t a b O r d e r     =   n e w   A r r a y , 
 
                                                                   u n o r d e r e d   =   n e w   A r r a y ; 
 
 
 
                                                           f u n c t i o n   e l e m e n t A r r a y s ( e l e ) 
 
                                                                 { f o r   ( v a r   i = 0 ; i < e l e . c h i l d N o d e s . l e n g t h ; i + + ) 
 
                                                                         { v a r   t e m p E l e   =   e l e . c h i l d N o d e s [ i ] ; 
 
                                                                           i f   ( t e m p E l e . n o d e T y p e = = 1   & &   t e m p E l e . s t y l e . d i s p l a y ! = ' n o n e '   & & 
 
                                                                                   ! t e m p E l e . d i s a b l e d       & &   t e m p E l e . t y p e ! = ' h i d d e n '   & & 
 
                                                                                   t e m p E l e . s t y l e . v i s i b i l i t y ! = ' h i d d e n ' ) 
 
                                                                                 { i f   ( t a g s T o F i n d . i n d e x O f ( t e m p E l e . t a g N a m e ) > - 1 ) 
 
                                                                                         { i f   ( t e m p E l e . t a b I n d e x > 0 )   { t a b O r d e r [ t e m p E l e . t a b I n d e x ]     =   t e m p E l e } 
 
                                                                                           e l s e                                         { u n o r d e r e d [ u n o r d e r e d . l e n g t h ]   =   t e m p E l e } 
 
                                                                                         } 
 
                                                                                   e l e m e n t A r r a y s ( t e m p E l e ) ; 
 
                                                                                 } 
 
                                                                         } 
 
                                                                 } ; 
 
 
 
                                                           e l e m e n t A r r a y s ( d o c u m e n t . b o d y ) ; 
 
 
 
                                                           w h i l e   ( t a b O r d e r . l e n g t h > 0   & &   t a b O r d e r [ 0 ] = = n u l l )   { t a b O r d e r . s h i f t ( ) ; } 
 
 
 
                                                           r e t u r n   t a b O r d e r . c o n c a t ( u n o r d e r e d ) ; 
 
                                                         } ; 
 
 
 
                                                   v a r   t a b S e q u e n c e d   =   o r d e r E l e m e n t s ( ) ; 
 
 
 
                                                   / /   f i n d   t h e   c u r r e n t   e l e m e n t   i n   t a b I n d e x   o r d e r e d   a r r a y 
 
                                                   / /   a n d   s e t   f o c u s   t o   t h e   n e x t   e l e m e n t   ( o r   t h e   f i r s t   i f 
 
                                                   / /   t h e   c u r r e n t   i s   t h e   l a s t ) 
 
 
 
                                                   f o r   ( v a r   i = 0 ; i < t a b S e q u e n c e d . l e n g t h ; i + + ) 
 
                                                         { i f   ( t a b S e q u e n c e d [ i ] = = c a l . t a r g e t E l e ) 
 
                                                                 { i f   ( i < ( t a b S e q u e n c e d . l e n g t h - 1 ) )   { t a b S e q u e n c e d [ i + 1 ] . f o c u s ( ) } 
 
                                                                   e l s e                                                       { t a b S e q u e n c e d [ 0 ] . f o c u s ( ) } 
 
                                                                   b r e a k ; 
 
                                                                 } 
 
                                                         } 
 
                                                 } 
 
                                         } 
 
                                   e l s e 
 
                                         { i f   ( ! c a l . t a r g e t E l e . d i s a b l e d             & &   c a l . t a r g e t E l e . s t y l e . d i s p l a y ! = ' n o n e '   & & 
 
                                                   c a l . t a r g e t E l e . t y p e ! = ' h i d d e n '   & &   c a l . t a r g e t E l e . s t y l e . v i s i b i l i t y ! = ' h i d d e n ' ) 
 
                                                 { c a l . t a r g e t E l e . f o c u s ( ) ; } 
 
                                         } 
 
                                 } ; 
 
 
 
                           f u n c t i o n   c h a n g e C l a s s ( e v t ) 
 
                                 { v a r   e l e   =   e v e n t T r i g g e r ( e v t ) ; 
 
 
 
                                   i f   ( e l e . n o d e T y p e = = 3 )   { e l e = e l e . p a r e n t N o d e ; } 
 
 
 
                                   i f   ( ( ( e v t ) ? e v t . t y p e : e v e n t . t y p e ) = = ' m o u s e o v e r ' ) 
 
                                         { s w i t c h   ( e l e . c l a s s N a m e ) 
 
                                                 { c a s e   ' j a c s C e l l s ' : 
 
                                                         e l e . c l a s s N a m e   =   ' j a c s C e l l s H o v e r ' ;                 b r e a k ; 
 
                                                   c a s e   ' j a c s C e l l s H i g h l i g h t e d ' : 
 
                                                         e l e . c l a s s N a m e   =   ' j a c s C e l l s H i g h l i g h t e d H o v e r ' ;                 b r e a k ; 
 
                                                   c a s e   ' j a c s C e l l s E x M o n t h ' : 
 
                                                         e l e . c l a s s N a m e   =   ' j a c s C e l l s E x M o n t h H o v e r ' ;   b r e a k ; 
 
                                                   c a s e   ' j a c s C e l l s W e e k e n d ' : 
 
                                                         e l e . c l a s s N a m e   =   ' j a c s C e l l s W e e k e n d H o v e r ' ;   b r e a k ; 
 
                                                   c a s e   ' j a c s C e l l s H i g h l i g h t e d W e e k e n d ' : 
 
                                                         e l e . c l a s s N a m e   =   ' j a c s C e l l s H i g h l i g h t e d W e e k e n d H o v e r ' ;   b r e a k ; 
 
                                                   c a s e   ' j a c s N o w ' : 
 
                                                         e l e . c l a s s N a m e   =   ' j a c s N o w H o v e r ' ;                   b r e a k ; 
 
                                                   c a s e   ' j a c s I n p u t D a t e ' : 
 
                                                         e l e . c l a s s N a m e   =   ' j a c s I n p u t D a t e H o v e r ' ; 
 
                                                 } 
 
                                         } 
 
                                   e l s e 
 
                                         { s w i t c h   ( e l e . c l a s s N a m e ) 
 
                                                 { c a s e   ' j a c s C e l l s H o v e r ' : 
 
                                                         e l e . c l a s s N a m e   =   ' j a c s C e l l s ' ;                           b r e a k ; 
 
                                                   c a s e   ' j a c s C e l l s H i g h l i g h t e d H o v e r ' : 
 
                                                         e l e . c l a s s N a m e   =   ' j a c s C e l l s H i g h l i g h t e d ' ;     b r e a k ; 
 
                                                   c a s e   ' j a c s C e l l s E x M o n t h H o v e r ' : 
 
                                                         e l e . c l a s s N a m e   =   ' j a c s C e l l s E x M o n t h ' ;             b r e a k ; 
 
                                                   c a s e   ' j a c s C e l l s W e e k e n d H o v e r ' : 
 
                                                         e l e . c l a s s N a m e   =   ' j a c s C e l l s W e e k e n d ' ;             b r e a k ; 
 
                                                   c a s e   ' j a c s C e l l s H i g h l i g h t e d W e e k e n d H o v e r ' : 
 
                                                         e l e . c l a s s N a m e   =   ' j a c s C e l l s H i g h l i g h t e d W e e k e n d ' ;             b r e a k ; 
 
                                                   c a s e   ' j a c s N o w H o v e r ' : 
 
                                                         e l e . c l a s s N a m e   =   ' j a c s N o w ' ;                             b r e a k ; 
 
                                                   c a s e   ' j a c s I n p u t D a t e H o v e r ' : 
 
                                                         e l e . c l a s s N a m e   =   ' j a c s I n p u t D a t e ' ; 
 
                                                 } 
 
                                         } 
 
                                   r e t u r n   t r u e ; 
 
                                 } ; 
 
 
 
                           f u n c t i o n   e v e n t T r i g g e r ( e v t ) 
 
                                 { i f   ( ! e v t )   { e v t   =   e v e n t ; } 
 
                                   r e t u r n   e v t . t a r g e t | | e v t . s r c E l e m e n t ; 
 
                                 } ; 
 
 
 
                           f u n c t i o n   w e e k N u m b e r ( i n D a t e ) 
 
                                 { / /   T h e   b a s e   d a y   i n   t h e   w e e k   o f   t h e   i n p u t   d a t e 
 
                                   v a r   i n D a t e W e e k B a s e   =   n e w   D a t e ( i n D a t e ) ; 
 
 
 
                                   i n D a t e W e e k B a s e . s e t D a t e ( i n D a t e W e e k B a s e . g e t D a t e ( )   -   i n D a t e W e e k B a s e . g e t D a y ( )   +   c a l . w e e k N u m b e r B a s e D a y   + 
 
                                                                                         ( ( i n D a t e . g e t D a y ( )   >   c a l . w e e k N u m b e r B a s e D a y ) ? 7 : 0 ) ) ; 
 
 
 
                                   / /   T h e   f i r s t   B a s e   D a y   i n   t h e   y e a r 
 
                                   v a r   f i r s t B a s e D a y   =   n e w   D a t e ( i n D a t e W e e k B a s e . g e t F u l l Y e a r ( ) , 0 , 1 ) ; 
 
 
 
                                   f i r s t B a s e D a y . s e t D a t e ( f i r s t B a s e D a y . g e t D a t e ( )   -   f i r s t B a s e D a y . g e t D a y ( )   +   c a l . w e e k N u m b e r B a s e D a y ) ; 
 
 
 
                                   i f   ( f i r s t B a s e D a y < n e w   D a t e ( i n D a t e W e e k B a s e . g e t F u l l Y e a r ( ) , 0 , 1 ) ) 
 
                                         { f i r s t B a s e D a y . s e t D a t e ( f i r s t B a s e D a y . g e t D a t e ( ) + 7 ) ; } 
 
 
 
                                   / /   S t a r t   o f   W e e k   0 1 
 
                                   v a r   s t a r t W e e k O n e   =   n e w   D a t e ( f i r s t B a s e D a y   -   c a l . w e e k N u m b e r B a s e D a y   +   i n D a t e . g e t D a y ( ) ) ; 
 
 
 
                                   i f   ( s t a r t W e e k O n e > f i r s t B a s e D a y )   { s t a r t W e e k O n e . s e t D a t e ( s t a r t W e e k O n e . g e t D a t e ( ) - 7 ) ; } 
 
 
 
                                   / /   S u b t r a c t   t h e   d a t e   o f   t h e   c u r r e n t   w e e k   f r o m   t h e   d a t e   o f   t h e   f i r s t   w e e k   o f   t h e   y e a r   t o 
 
                                   / /   g e t   t h e   n u m b e r   o f   w e e k s   i n   m i l l i s e c o n d s .     D i v i d e   b y   t h e   n u m b e r   o f   m i l l i s e c o n d s   i n   a 
 
                                   / /   w e e k   t h e n   r o u n d   t o   n o   d e c i m a l s   i n   o r d e r   t o   r e m o v e   t h e   e f f e c t   o f   d a y l i g h t   s a v i n g .     A d d 
 
                                   / /   o n e   t o   m a k e   t h e   f i r s t   w e e k ,   w e e k   1 .     P l a c e   a   s t r i n g   z e r o   o n   t h e   f r o n t   s o   t h a t   w e e k 
 
                                   / /   n u m b e r s   a r e   z e r o   f i l l e d . 
 
 
 
                                   v a r   w e e k N o   =   ' 0 ' + ( M a t h . r o u n d ( ( i n D a t e W e e k B a s e   -   f i r s t B a s e D a y ) / 6 0 4 8 0 0 0 0 0 , 0 ) + 1 ) ; 
 
 
 
                                   / /   R e t u r n   t h e   l a s t   t w o   c h a r a c t e r s   i n   t h e   w e e k   n u m b e r   s t r i n g 
 
 
 
                                   r e t u r n   w e e k N o . s u b s t r i n g ( w e e k N o . l e n g t h - 2 , w e e k N o . l e n g t h ) ; 
 
                                 } ; 
 
 
 
                           / /   w a l k   t h e   D O M   t o   d i s p l a y   t h e   d a t e s . 
 
 
 
                           v a r   c e l l s   =   g e t E l ( c a l I d + ' C e l l s ' ) . c h i l d N o d e s ; 
 
 
 
                           f o r   ( v a r   i = 0 ; i < c e l l s . l e n g t h ; i + + ) 
 
                                 { v a r   r o w s   =   c e l l s [ i ] ; 
 
                                   i f   ( r o w s . n o d e T y p e = = 1   & &   r o w s . t a g N a m e = = ' T R ' ) 
 
                                         { t m p E l   =   r o w s . c h i l d N o d e s [ 0 ] ; 
 
                                           i f   ( c a l . w e e k N u m b e r D i s p l a y ) 
 
                                                     { / / C a l c u l a t e   t h e   w e e k   n u m b e r   u s i n g   s h o w D a t e 
 
                                                       t m p E l . i n n e r H T M L   =   w e e k N u m b e r ( s h o w D a t e ) ; 
 
                                                       t m p E l . s t y l e . b o r d e r C o l o r   = 
 
                                                               ( t m p E l . c u r r e n t S t y l e ) 
 
                                                                         ? t m p E l . c u r r e n t S t y l e [ ' b a c k g r o u n d C o l o r ' ] 
 
                                                                         : ( d o c u m e n t . d e f a u l t V i e w . g e t C o m p u t e d S t y l e ) 
 
                                                                                 ? d o c u m e n t . d e f a u l t V i e w . g e t C o m p u t e d S t y l e ( t m p E l , n u l l ) . b a c k g r o u n d C o l o r 
 
                                                                                 : ' ' ; 
 
                                                       t m p E l . s t y l e . d i s p l a y   =   ' ' ; 
 
                                                     } 
 
                                           e l s e     { t m p E l . s t y l e . d i s p l a y = ' n o n e ' ; } 
 
 
 
                                           f o r   ( v a r   j = 1 ; j < r o w s . c h i l d N o d e s . l e n g t h ; j + + ) 
 
                                                 { v a r   c o l s   =   r o w s . c h i l d N o d e s [ j ] ; 
 
                                                   i f   ( c o l s . n o d e T y p e = = 1   & &   c o l s . t a g N a m e = = ' T D ' ) 
 
                                                         { r o w s . c h i l d N o d e s [ j ] . i n n e r H T M L   =   s h o w D a t e . g e t D a t e ( ) ; 
 
 
 
                                                           v a r   c e l l   =   r o w s . c h i l d N o d e s [ j ] ; 
 
 
 
                                                           c e l l . s t y l e . v i s i b i l i t y   =   ( c a l . o u t O f M o n t h H i d e   & & 
 
                                                                                                             ( s h o w D a t e   <   ( n e w   D a t e ( s h o w D a t e . g e t F u l l Y e a r ( ) , c u r M o n t h , 1 , s h o w D a t e . g e t H o u r s ( ) ) )   | | 
 
                                                                                                               s h o w D a t e   >   ( n e w   D a t e ( s h o w D a t e . g e t F u l l Y e a r ( ) , c u r M o n t h + 1 , 0 , s h o w D a t e . g e t H o u r s ( ) ) ) 
 
                                                                                                             ) 
 
                                                                                                           ) ? ' h i d d e n ' : ' i n h e r i t ' ; 
 
 
 
                                                           / /   D i s a b l e   i f   t h e   o u t O f R a n g e D i s a b l e   o p t i o n   h a s   b e e n   s e t   a n d   t h e   c u r r e n t   d a t e 
 
                                                           / /   i s   o u t   o f   r a n g e   o r   t h e   c a l . v a l u e s E n a b l e d   o p t i o n   i s   t r u e . 
 
                                                           v a r   d i s a b l e d   =   c a l . v a l u e s E n a b l e d ; 
 
 
 
                                                           i f   ( ( c a l . o u t O f R a n g e D i s a b l e   & &   ( s h o w D a t e   <   ( n e w   D a t e ( c a l . b a s e Y e a r , 0 , 1 , 1 2 ) )   | | 
 
                                                                                                                         s h o w D a t e   >   ( n e w   D a t e ( c a l . b a s e Y e a r + c a l . d r o p D o w n Y e a r s , 0 , 0 , 1 2 ) ) 
 
                                                                                                                       ) 
 
                                                                   )   | | 
 
                                                                   ( c a l . o u t O f M o n t h D i s a b l e   & &   ( s h o w D a t e   <   ( n e w   D a t e ( s h o w D a t e . g e t F u l l Y e a r ( ) , c u r M o n t h , 1 , s h o w D a t e . g e t H o u r s ( ) ) )   | | 
 
                                                                                                                         s h o w D a t e   >   ( n e w   D a t e ( s h o w D a t e . g e t F u l l Y e a r ( ) , c u r M o n t h + 1 , 0 , s h o w D a t e . g e t H o u r s ( ) ) ) 
 
                                                                                                                       ) 
 
                                                                   ) 
 
                                                                 )   { d i s a b l e d   =   t r u e ; } 
 
                                                           e l s e 
 
                                                                 { i f   ( ( c a l . d a y s . j o i n ( ) . s e a r c h ( ( ( j - 1 + ( 7 * ( i * c e l l s . l e n g t h / 6 ) ) + c a l . w e e k S t a r t ) % 7 ) ) > - 1 )   | | 
 
                                                                             ! c a l . d a y C e l l s [ j - 1 + ( 7 * ( ( i * c e l l s . l e n g t h ) / 6 ) ) ] 
 
                                                                         )       { d i s a b l e d   =   ! c a l . v a l u e s E n a b l e d ; }   / /   S e t   ( D i s a b l e   o r   E n a b l e )   i f   t h e   d a y   i s   p a s s e d   a s   a   p a r a m e t e r   o f   J A C S . s h o w 
 
                                                                   e l s e       { f o r   ( v a r   k = 0 ; k < c a l . d a t e s . l e n g t h ; k + + ) 
 
                                                                                         { i f   ( t y p e o f   c a l . d a t e s [ k ] = = ' o b j e c t '   & & 
 
                                                                                                   ( ( c a l . d a t e s [ k ] . c o n s t r u c t o r = = D a t e     & &   c o m p a r e D a t e V a l u e   = =   c a l . d a t e s [ k ] . v a l u e O f ( ) )   | | 
 
                                                                                                     ( c a l . d a t e s [ k ] . c o n s t r u c t o r = = A r r a y   & &   c o m p a r e D a t e V a l u e   > =   c a l . d a t e s [ k ] [ 0 ] . v a l u e O f ( )   & & 
 
                                                                                                                                                                             c o m p a r e D a t e V a l u e   < =   c a l . d a t e s [ k ] [ 1 ] . v a l u e O f ( ) 
 
                                                                                                     ) 
 
                                                                                                   ) 
 
                                                                                                 ) 
 
                                                                                                 { d i s a b l e d   =   ! c a l . v a l u e s E n a b l e d ; 
 
                                                                                                   b r e a k ; 
 
                                                                                                 } 
 
                                                                                         } 
 
                                                                                 } 
 
                                                                 } 
 
 
 
                                                           i f   ( d i s a b l e d ) 
 
                                                                 { r o w s . c h i l d N o d e s [ j ] . o n c l i c k   =   n u l l ; 
 
 
 
                                                                   i f   ( g e t E l ( ' j a c s I E ' ) ) 
 
                                                                         { r o w s . c h i l d N o d e s [ j ] . o n m o u s e o v e r   =   n u l l ; 
 
                                                                           r o w s . c h i l d N o d e s [ j ] . o n m o u s e o u t     =   n u l l ; 
 
                                                                         } 
 
 
 
                                                                   c e l l . c l a s s N a m e = 
 
                                                                         ( s h o w D a t e . g e t M o n t h ( ) ! = c u r M o n t h ) 
 
                                                                                 ? ' j a c s C e l l s E x M o n t h D i s a b l e d ' 
 
                                                                                 : ( c a l . f u l l I n p u t D a t e   & & 
 
                                                                                     c o m p a r e D a t e V a l u e = = 
 
                                                                                     c a l . s e e d D a t e . v a l u e O f ( ) ) 
 
                                                                                         ? ' j a c s I n p u t D a t e D i s a b l e d ' 
 
                                                                                         : ( s h o w D a t e . g e t D a y ( ) % 6 = = 0 ) 
 
                                                                                                 ? ' j a c s C e l l s W e e k e n d D i s a b l e d ' 
 
                                                                                                 : ' j a c s C e l l s D i s a b l e d ' ; 
 
 
 
                                                                   c e l l . s t y l e . b o r d e r C o l o r   = 
 
                                                                           ( c a l . f o r m a t T o d a y C e l l   & &   s h o w D a t e . t o D a t e S t r i n g ( ) = = d a t e N o w . t o D a t e S t r i n g ( ) ) 
 
                                                                                 ? c a l . t o d a y C e l l B o r d e r C o l o u r 
 
                                                                                 : ( c e l l . c u r r e n t S t y l e ) 
 
                                                                                         ? c e l l . c u r r e n t S t y l e [ ' b a c k g r o u n d C o l o r ' ] 
 
                                                                                         : ( d o c u m e n t . d e f a u l t V i e w . g e t C o m p u t e d S t y l e ) 
 
                                                                                                 ? d o c u m e n t . d e f a u l t V i e w . g e t C o m p u t e d S t y l e ( c e l l , n u l l ) . b a c k g r o u n d C o l o r 
 
                                                                                                 : ' ' ; 
 
                                                                 } 
 
                                                           e l s e 
 
                                                                 { f u n c t i o n   c e l l O u t p u t ( e v t ) 
 
                                                                         { v a r   e l e   =   e v e n t T r i g g e r ( e v t ) , 
 
                                                                                   o u t p u t D a t e   =   n e w   D a t e ( s t a r t D a t e ) ; 
 
 
 
                                                                           i f   ( e l e . n o d e T y p e = = 3 )   e l e = e l e . p a r e n t N o d e ; 
 
 
 
                                                                           o u t p u t D a t e . s e t D a t e ( s t a r t D a t e . g e t D a t e ( )   + 
 
                                                                                 p a r s e I n t ( e l e . i d . s u b s t r ( c a l I d . l e n g t h + 5 ) , 1 0 ) ) ; 
 
 
 
                                                                           s e t O u t p u t ( o u t p u t D a t e , c a l I d ) ; 
 
                                                                         } ; 
 
 
 
                                                                   i f   ( c a l . a c t i v e ) 
 
                                                                         { r o w s . c h i l d N o d e s [ j ] . o n c l i c k = c e l l O u t p u t ; } 
 
 
 
                                                                   i f   ( g e t E l ( ' j a c s I E ' ) ) 
 
                                                                         { r o w s . c h i l d N o d e s [ j ] . o n m o u s e o v e r   =   c h a n g e C l a s s ; 
 
                                                                           r o w s . c h i l d N o d e s [ j ] . o n m o u s e o u t     =   c h a n g e C l a s s ; 
 
                                                                         } 
 
 
 
                                                                   v a r   h i g h l i g h t e d   =   f a l s e ; 
 
 
 
                                                                   f o r   ( v a r   k = 0 ; k < c a l . h i g h l i g h t D a t e s . l e n g t h ; k + + ) 
 
                                                                         { i f   ( t y p e o f   c a l . h i g h l i g h t D a t e s [ k ] = = ' o b j e c t '   & & 
 
                                                                                   ( ( c a l . h i g h l i g h t D a t e s [ k ] . c o n s t r u c t o r = = D a t e     & & 
 
                                                                                       c o m p a r e D a t e V a l u e   = =   c a l . h i g h l i g h t D a t e s [ k ] . v a l u e O f ( ) )   | | 
 
                                                                                     ( c a l . h i g h l i g h t D a t e s [ k ] . c o n s t r u c t o r = = A r r a y   & & 
 
                                                                                       c o m p a r e D a t e V a l u e   > =   c a l . h i g h l i g h t D a t e s [ k ] [ 0 ] . v a l u e O f ( )   & & 
 
                                                                                       c o m p a r e D a t e V a l u e   < =   c a l . h i g h l i g h t D a t e s [ k ] [ 1 ] . v a l u e O f ( ) 
 
                                                                                     ) 
 
                                                                                   ) 
 
                                                                                 ) 
 
                                                                                 { h i g h l i g h t e d   =   t r u e ; 
 
                                                                                   b r e a k ; 
 
                                                                                 } 
 
                                                                         } 
 
 
 
                                                                   c e l l . c l a s s N a m e = 
 
                                                                           ( s h o w D a t e . g e t M o n t h ( ) ! = c u r M o n t h ) 
 
                                                                                 ? ' j a c s C e l l s E x M o n t h ' 
 
                                                                                 : ( c a l . f u l l I n p u t D a t e   & & 
 
                                                                                     c o m p a r e D a t e V a l u e = = 
 
                                                                                     c a l . s e e d D a t e . v a l u e O f ( ) ) 
 
                                                                                         ? ' j a c s I n p u t D a t e ' 
 
                                                                                         : ( s h o w D a t e . g e t D a y ( ) % 6 = = 0 ) 
 
                                                                                                 ? ( h i g h l i g h t e d ) ? ' j a c s C e l l s H i g h l i g h t e d W e e k e n d ' : ' j a c s C e l l s W e e k e n d ' 
 
                                                                                                 : ( h i g h l i g h t e d ) ? ' j a c s C e l l s H i g h l i g h t e d ' : ' j a c s C e l l s ' ; 
 
 
 
                                                                   c e l l . s t y l e . b o r d e r C o l o r   = 
 
                                                                           ( c a l . f o r m a t T o d a y C e l l   & &   s h o w D a t e . t o D a t e S t r i n g ( ) = = d a t e N o w . t o D a t e S t r i n g ( ) ) 
 
                                                                                 ? c a l . t o d a y C e l l B o r d e r C o l o u r 
 
                                                                                 : ( c e l l . c u r r e n t S t y l e ) 
 
                                                                                         ? c e l l . c u r r e n t S t y l e [ ' b a c k g r o u n d C o l o r ' ] 
 
                                                                                         : ( d o c u m e n t . d e f a u l t V i e w . g e t C o m p u t e d S t y l e ) 
 
                                                                                                 ? d o c u m e n t . d e f a u l t V i e w . g e t C o m p u t e d S t y l e ( c e l l , n u l l ) . b a c k g r o u n d C o l o r 
 
                                                                                                 : ' ' ; 
 
                                                               } 
 
 
 
                                                           s h o w D a t e . s e t D a t e ( s h o w D a t e . g e t D a t e ( ) + 1 ) ; 
 
                                                           c o m p a r e D a t e V a l u e   =   n e w   D a t e ( s h o w D a t e . g e t F u l l Y e a r ( ) , 
 
                                                                                                                   s h o w D a t e . g e t M o n t h ( ) , 
 
                                                                                                                   s h o w D a t e . g e t D a t e ( ) ) . v a l u e O f ( ) ; 
 
                                                         } 
 
                                                 } 
 
                                         } 
 
                                 } 
 
                         } 
 
 
 
                   / /   O p e r a   h a s   a   b u g   w i t h   s e t t i n g   t h e   s e l e c t e d   i n d e x . 
 
                   / /   I t   r e q u i r e s   t h e   f o l l o w i n g   w o r k - a r o u n d   t o   f o r c e   S E L E C T s   t o   d i s p l a y   c o r r e c t l y . 
 
                   / /   A l s o   O p e r a ' s   p o o r   d y n a m i c   r e n d e r i n g   p r i o r   t o   9 . 5   r e q u i r e s 
 
                   / /   t h e   v i s i b i l i t y   t o   b e   r e s e t   t o   p r e v e n t   g a r b a g e   i n   t h e   c a l e n d a r 
 
                   / /   w h e n   t h e   d i s p l a y e d   m o n t h   i s   c h a n g e d . 
 
                   i f   ( w i n d o w . o p e r a ) 
 
                         { s e l M o n t h s . s t y l e . d i s p l a y   =   ' i n l i n e ' ; 
 
                             s e l Y e a r s . s t y l e . d i s p l a y   =   ' i n l i n e ' ; 
 
                           c a l . s t y l e . v i s i b i l i t y   =   ' h i d d e n ' ; 
 
                           c a l . s t y l e . v i s i b i l i t y   =   ' i n h e r i t ' ; 
 
                         } 
 
                 } ; 
 
 
 
           f u n c t i o n   h i d e ( i n s t a n c e I D ) 
 
                 { i f   ( t y p e o f   i n s t a n c e I D = = ' o b j e c t ' ) 
 
                                 { f o r   ( v a r   i = 0 ; i < c a l s . l e n g t h ; i + + )   { h i d e O n e ( c a l s [ i ] ) ; } } 
 
                   e l s e       { h i d e O n e ( i n s t a n c e I D ) ; } 
 
 
 
                   f u n c t i o n   h i d e O n e ( i d ) 
 
                         { c a l   =   g e t E l ( i d ) ; 
 
 
 
                           i f   ( c a l . d y n a m i c ) 
 
                                 { c a l . s t y l e . v i s i b i l i t y   =   ' h i d d e n ' ; 
 
                                   g e t E l ( i d + ' I f r a m e ' ) . s t y l e . v i s i b i l i t y = ' h i d d e n ' ; 
 
                                   d o N e x t ( c a l ) ; 
 
                                 } 
 
                         } ; 
 
                 } ; 
 
 
 
           f u n c t i o n   d o N e x t ( c a l ) 
 
                 { i f   ( c a l . a r r O n N e x t ) 
 
                         { i f   ( c a l . a r r O n N e x t . l e n g t h   >   0 ) 
 
                                   { c a l . o n N e x t   =   c a l . a r r O n N e x t . s h i f t ( ) ; 
 
                                     c a l . o n N e x t ( ) ; 
 
                                     / /   E x p l i c i t   n u l l   s e t   t o   p r e v e n t   c l o s u r e   c a u s i n g   m e m o r y   l e a k 
 
                                     c a l . o n N e x t   =   n u l l ; 
 
                                   } 
 
                         } 
 
                 } ; 
 
 
 
           f u n c t i o n   s t o p P r o p a g a t i o n ( e v t ) 
 
               { i f   ( e v t . s t o p P r o p a g a t i o n ) 
 
                           { i f   ( e v t . t a r g e t ! = e v t . c u r r e n t T a r g e t )   { e v t . s t o p P r o p a g a t i o n ( ) ;   e v t . p r e v e n t D e f a u l t ( ) ; } } 
 
                 e l s e   { e v t . c a n c e l B u b b l e   =   t r u e ; } 
 
               } ; 
 
 
 
           f u n c t i o n   t o D a t e ( d ) 
 
           { 
 
                   i f ( t y p e o f   d = = ' o b j e c t ' ) 
 
                   { 
 
                           r e t u r n   d ; 
 
                   } 
 
                   v a r   l = / [ \ - \ / ] / , n = / ( \ d { 4 } ) ( \ d { 2 } ) ( \ d { 2 } ) / ; 
 
                   v a r   a = l . t e s t ( d ) ? d . s p l i t ( l ) : d . m a t c h ( n ) . s l i c e ( 1 ) ; 
 
                   r e t u r n   n e w   D a t e ( a [ 0 ] , N u m b e r ( a [ 1 ] ) - 1 , a [ 2 ] ) ; 
 
           } ; 
 
 
 
 / /   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 / /       E n d   o f   P r i v a t e   F u n c t i o n   L i b r a r y 
 
 / /   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 / /   S t a r t   o f   P u b l i c     F u n c t i o n   L i b r a r y 
 
 / /   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 
 
           r e t u r n   { s h o w :   f u n c t i o n ( e l e ) 
 
                                 { / /   C h e c k   t h e   t y p e   o f   a n y   a d d i t i o n a l   p a r a m e t e r s . 
 
                                   / /   T h e   o p t i o n a l   s t r i n g   p a r a m e t e r   i s   a   c a l e n d a r   I D , 
 
                                   / /   T a k e   a n y   r e m a i n i n g   p a r a m e t e r s   a s   d a y   n u m b e r s   t o   b e   h a n d l e d 
 
                                   / /   ( e n a b l e d / d i s a b l e d )   a c c o r d i n g   t o   t h e   s e t t i n g   o f   t h e 
 
                                   / /   c a l e n d a r ' s     v a l u e s E n a b l e d     a t t r i b u t e . 
 
                                   / /   0   =   S u n d a y   t h r o u g h   t o   6   =   S a t u r d a y . 
 
 
 
                                   i f   ( t y p e o f   a r g u m e n t s [ 1 ] = = ' o b j e c t ' ) 
 
                                         { v a r   d y n a m i c   =   t r u e ; 
 
 
 
                                           i f   ( t y p e o f   a r g u m e n t s [ 2 ] = = ' s t r i n g ' ) 
 
                                                         { v a r   c a l I d   =   a r g u m e n t s [ 2 ] ,   m i n   =   3 ; } 
 
                                           e l s e       { v a r   c a l I d   =   ' j a c s ' ,               m i n   =   2 ; } 
 
 
 
                                           / /   S t o p   t h e   c l i c k   e v e n t   t h a t   o p e n s   t h e   c a l e n d a r 
 
                                           / /   f r o m   b u b b l i n g   u p   t o   t h e   d o c u m e n t - l e v e l   e v e n t 
 
                                           / /   h a n d l e r   t h a t   h i d e s   i t ! 
 
 
 
                                           v a r   s o u r c e   =   a r g u m e n t s [ 1 ] ; 
 
                                           i f   ( ! s o u r c e )   { s o u r c e   =   w i n d o w . e v e n t ; } 
 
 
 
                                           i f   ( s o u r c e . t a g N a m e )         / /   S e c o n d   p a r a m e t e r   i s n ' t   a n   e v e n t   i t ' s   a n   e l e m e n t 
 
                                                 { v a r   s o u r c e E l e   =   s o u r c e ; 
 
                                                   i f   ( g e t E l ( ' j a c s I E ' ) )     { w i n d o w . e v e n t . c a n c e l B u b b l e   =   t r u e ; } 
 
                                                   e l s e   { s o u r c e E l e . p a r e n t N o d e . a d d E v e n t L i s t e n e r ( ' c l i c k ' , s t o p P r o p a g a t i o n , f a l s e ) ; } 
 
                                                 } 
 
                                           e l s e       / /   S e c o n d   p a r a m e t e r   i s   a n   e v e n t 
 
                                                 { v a r   e v e n t   =   s o u r c e ; 
 
                                                   / /   S t o p   t h e   c l i c k   e v e n t   t h a t   o p e n s   t h e   c a l e n d a r   f r o m   b u b b l i n g   u p   t o 
 
                                                   / /   t h e   d o c u m e n t - l e v e l   e v e n t   h a n d l e r   t h a t   h i d e s   i t ! 
 
                                                   v a r   s o u r c e E l e   =   ( e v e n t . t a r g e t ) ? e v e n t . t a r g e t : e v e n t . s r c E l e m e n t ; 
 
                                                   i f   ( e v e n t . s t o p P r o p a g a t i o n )   { e v e n t . s t o p P r o p a g a t i o n ( ) ; } 
 
                                                   e l s e                                               { e v e n t . c a n c e l B u b b l e   =   t r u e ; } 
 
                                                 } 
 
                                         } 
 
                                   e l s e 
 
                                         { v a r   s o u r c e E l e   =   e l e ,   d y n a m i c   =   f a l s e ; 
 
 
 
                                           i f   ( t y p e o f   a r g u m e n t s [ 1 ] = = ' s t r i n g ' ) 
 
                                                         { v a r   c a l I d   =   a r g u m e n t s [ 1 ] ,   m i n   =   2 ; } 
 
                                           e l s e       { v a r   c a l I d   =   ' j a c s ' ,               m i n   =   1 ; } 
 
                                         } 
 
 
 
                                   / /   A d d   e v e n t   h a n d l e r s   t o   t h e   r e t u r n   e l e m e n t   a n d   i t s   p a r e n t . 
 
                                   / /   T h i s   h e l p s   t h e   s c r i p t   t o   s u p p o r t   t a b   s e q u e n c e s   a n d   f o c u s   e v e n t s . 
 
 
 
                                   i f   ( d o c u m e n t . a d d E v e n t L i s t e n e r ) 
 
                                                 { e l e . a d d E v e n t L i s t e n e r ( ' k e y d o w n ' , h i d e O n T a b , f a l s e ) ; 
 
                                                   e l e . p a r e n t N o d e . a d d E v e n t L i s t e n e r ( ' c l i c k ' , s t o p P r o p a g a t i o n , f a l s e ) ; } 
 
                                   e l s e       { e l e . a t t a c h E v e n t ( ' o n k e y d o w n ' , h i d e O n T a b ) ; 
 
                                                   i f   ( e l e . p a r e n t N o d e ! = d o c u m e n t . b o d y ) 
 
                                                         { e l e . p a r e n t N o d e . a t t a c h E v e n t ( ' o n c l i c k ' , s t o p P r o p a g a t i o n ) ; } 
 
                                                 } 
 
 
 
                                   f u n c t i o n   h i d e O n T a b ( e v t ) 
 
                                         { i f   ( ! e v t )   { v a r   e v t   =   w i n d o w . e v e n t ; } 
 
                                           i f   ( ( e v t . k e y C o d e | | e v t . w h i c h ) = = 9 )   { h i d e ( c a l I d ) ; } 
 
                                         } ; 
 
 
 
                                   / /   C r e a t e   t h e   c a l e n d a r   s t r u c t u r e .   O n e   i s   e n o u g h   u n l e s s   y o u   w a n t   m o r e 
 
                                   / /   t h a n   o n e   c a l e n d a r   v i s i b l e   o n   t h e   p a g e   a t   o n e   t i m e .     I f   y o u   D O   n e e d 
 
                                   / /   m o r e ,   y o u   c a n   c r e a t e   a s   m a n y   a s   y o u   l i k e   b u t   e a c h   m u s t   h a v e   a   u n i q u e 
 
                                   / /   I D . 
 
 
 
                                   / /   T h e   f i r s t   p a r a m e t e r   o f   J A C S . m a k e   i s   t h e   I D   o f   t h e   c a l e n d a r .   T h e 
 
                                   / /   s e c o n d   i s   a   b o o l e a n   t h a t   d e t e r m i n e s   w h e t h e r   t h e   c a l e n d a r   i s   t o   b e 
 
                                   / /   s t a t i c   o n   t h e   p a g e   ( a s s i g n e d   t o   a   s i n g l e   i n p u t   f i e l d   a n d   a l w a y s 
 
                                   / /   v i s i b l e )   o r   d y n a m i c   ( s h o w n   a n d   h i d d e n   o n   e v e n t s   a n d   c a n   b e   a s s i g n e d 
 
                                   / /   t o   a n y   n u m b e r   o f   i n p u t   f i e l d s ) . 
 
 
 
                                   / / i f   ( ! g e t E l ( c a l I d ) )   { J A C S . m a k e ( c a l I d , d y n a m i c ) ; } 
 
                                   v a r   t m p C a l   =   g e t E l ( c a l I d ) ;   / /   m o d i f y   b y   c 
 
                                   v a r   t m p I f r a m e   =   g e t E l ( c a l I d + " I f r a m e " ) ; 
 
                                   i f   ( t m p C a l & & t m p I f r a m e ) { t m p C a l . p a r e n t N o d e . r e m o v e C h i l d ( t m p C a l ) ; t m p I f r a m e . p a r e n t N o d e . r e m o v e C h i l d ( t m p I f r a m e ) ; } 
 
                                   J A C S . m a k e ( c a l I d , d y n a m i c ) ; 
 
 
 
                                   c a l   =   g e t E l ( c a l I d ) ; 
 
 
 
                                   / /   I f   t h e   c a l e n d a r   h a s   b e e n   t r i g g e r e d   u s i n g   a n   o n f o c u s   e v e n t , 
 
                                   / /   a n d   t h e   s c r i p t   a c t i v e l y   r e t u r n s   t h e   f o c u s   t o   t h e   t a r g e t 
 
                                   / /   e l e m e n t   ( i . e .   w h e n   c a l . o n B l u r M o v e N e x t   =   f a l s e ) .   W e   n e e d 
 
                                   / /   t o   k i l l   t h e   e v e n t . 
 
 
 
                                   i f   ( e v e n t ) 
 
                                         { i f   ( e v e n t . t y p e   = =   ' f o c u s '   & &   c a l . d a t e R e t u r n e d   & &   ! c a l . o n B l u r M o v e N e x t   & &   c a l . p r e v E v e n t T y p e   = =   ' f o c u s ' ) 
 
                                                 { s t o p P r o p a g a t i o n ( e v e n t ) ;   c a l . p r e v E v e n t T y p e   =   ' ' ;   c a l . d a t e R e t u r n e d   =   f a l s e ;   r e t u r n   f a l s e ; } 
 
                                           c a l . p r e v E v e n t T y p e   =   e v e n t . t y p e ; 
 
                                         } 
 
 
 
                                   i f   ( c a l . s t y l e . v i s i b i l i t y   ! =   ' h i d d e n '   & & 
 
                                           c a l . s t y l e . v i s i b i l i t y   ! =   ' i n h e r i t '   & & 
 
                                           t y p e o f   d o N e x t   = =   ' f u n c t i o n ' )   { d o N e x t ( c a l ) ; } 
 
 
 
                                   c a l . t r i g g e r E l e   =   s o u r c e E l e ; 
 
 
 
                                   c a l . d a t e R e t u r n e d   =   f a l s e ; 
 
                                   c a l . a c t i v e T o d a y     =   t r u e ; 
 
 
 
                                   / /   S e t   e n a b l e d / d i s a b l e d   d a y s 
 
 
 
                                   i f   ( a r g u m e n t s . l e n g t h = = m i n )   { c a l . d a y s . l e n g t h = 0 ; } 
 
                                   e l s e   { s e l e c t e d D a y s   =   ( t y p e o f   a r g u m e n t s [ m i n ] = = ' o b j e c t ' ) ? a r g u m e n t s [ m i n ] : a r g u m e n t s ; 
 
                                               f o r   ( v a r   i = ( m i n | 0 ) ; i < s e l e c t e d D a y s . l e n g t h ; i + + ) 
 
                                                   { i f   ( c a l . d a y s . j o i n ( ) . i n d e x O f ( s e l e c t e d D a y s [ i ] ) = = - 1 )   { c a l . d a y s . p u s h ( s e l e c t e d D a y s [ i ] ) ; } } 
 
                                             } 
 
 
 
                                   f o r   ( v a r   i = 0 ; i < c a l . d a y s . l e n g t h ; i + + ) 
 
                                         { i f   ( d a t e N o w . g e t D a y ( ) = = c a l . d a y s [ i ] % 7 )   { c a l . a c t i v e T o d a y   =   f a l s e ;   b r e a k ; } } 
 
 
 
                                   / /       I f   n o   v a l u e   i s   p r e s e t   t h e n   t h e   s e e d   d a t e   i s 
 
                                   / /             T o d a y   ( w h e n   t o d a y   i s   i n   r a n g e )   O R 
 
                                   / /             T h e   m i d d l e   o f   t h e   d a t e   r a n g e . 
 
 
 
                                   c a l . s e e d D a t e   =   d a t e N o w ; 
 
 
 
                                   / /   F i n d   t h e   d a t e   a n d   S t r i p   s p a c e   c h a r a c t e r s   f r o m   s t a r t   a n d 
 
                                   / /   e n d   o f   d a t e   i n p u t . 
 
 
 
                                   v a r   d a t e V a l u e   =   ' ' ; 
 
 
 
                                   i f   ( e l e . v a l u e )   { d a t e V a l u e   =   e l e . v a l u e . r e p l a c e ( / ^ \ s + / , ' ' ) . r e p l a c e ( / \ s + $ / , ' ' ) ; } 
 
                                   e l s e       { i f   ( t y p e o f   e l e . v a l u e   = =   ' u n d e f i n e d ' ) 
 
                                                         { v a r   c h i l d N o d e s   =   e l e . c h i l d N o d e s ; 
 
                                                           f o r   ( v a r   i = 0 ; i < c h i l d N o d e s . l e n g t h ; i + + ) 
 
                                                                 { i f   ( c h i l d N o d e s [ i ] . n o d e T y p e   = =   3 ) 
 
                                                                         { d a t e V a l u e   =   c h i l d N o d e s [ i ] . n o d e V a l u e . r e p l a c e ( / ^ \ s + / , ' ' ) . r e p l a c e ( / \ s + $ / , ' ' ) ; 
 
                                                                           i f   ( d a t e V a l u e . l e n g t h   >   0 ) 
 
                                                                                 { c a l . t r i g g e r E l e . t e x t N o d e   =   c h i l d N o d e s [ i ] ; 
 
                                                                                   c a l . t r i g g e r E l e . l e n             =   c h i l d N o d e s [ i ] . n o d e V a l u e . l e n g t h ; 
 
                                                                                   b r e a k ; 
 
                                                                                 } 
 
                                                                         } 
 
                                                                 } 
 
                                                         } 
 
                                                 } 
 
 
 
                                   / /   S e t   t h e   y e a r   r a n g e 
 
 
 
                                   v a r   y e a r O p t i o n s   =   g e t E l ( c a l I d + ' Y e a r s ' ) . o p t i o n s ; 
 
 
 
                                   i f   ( y e a r O p t i o n s . l e n g t h = = 0   | |   y e a r O p t i o n s [ 0 ] . v a l u e ! = c a l . b a s e Y e a r ) 
 
                                         { y e a r O p t i o n s . l e n g t h   =   0 ; 
 
                                           f o r   ( v a r   i = 0 ; i < c a l . d r o p D o w n Y e a r s ; i + + )   { y e a r O p t i o n s [ i ]   =   n e w   O p t i o n ( ( c a l . b a s e Y e a r + i ) , ( c a l . b a s e Y e a r + i ) ) ; } 
 
                                         } 
 
 
 
                                   i f   ( d a t e V a l u e . l e n g t h = = 0 ) 
 
                                         { / /   I f   n o   v a l u e   i s   e n t e r e d   a n d   t o d a y   i s   w i t h i n   t h e   r a n g e , 
 
                                           / /   u s e   t o d a y ' s   d a t e ,   o t h e r w i s e   u s e   t h e   m i d d l e   o f   t h e   v a l i d   r a n g e . 
 
 
 
                                           c a l . f u l l I n p u t D a t e = f a l s e ; 
 
 
 
                                           i f   ( ( n e w   D a t e ( c a l . b a s e Y e a r + c a l . d r o p D o w n Y e a r s , 0 , 0 ) ) < c a l . s e e d D a t e   | | 
 
                                                   ( n e w   D a t e ( c a l . b a s e Y e a r , 0 , 1 ) )                                     > c a l . s e e d D a t e 
 
                                                 ) 
 
                                                 { c a l . s e e d D a t e   =   n e w   D a t e ( c a l . b a s e Y e a r + M a t h . f l o o r ( c a l . d r o p D o w n Y e a r s   /   2 ) ,   5 ,   1 ) ; } 
 
                                         } 
 
                                   e l s e 
 
                                         { f u n c t i o n   i n p u t F o r m a t ( ) 
 
                                                 { v a r   s e e d   =   n e w   A r r a y ( ) , 
 
                                                           i n p u t   =   d a t e V a l u e . s p l i t ( n e w   R e g E x p ( ' [ \ \ ' + c a l . d e l i m i t e r s . j o i n ( ' \ \ ' ) + ' ] + ' , ' g ' ) ) ; 
 
 
 
                                                   / /   " E s c a p e "   a l l   t h e   u s e r   d e f i n e d   d a t e   d e l i m i t e r s   a b o v e   - 
 
                                                   / /   s e v e r a l   d e l i m i t e r s   w i l l   n e e d   i t   a n d   i t   d o e s   n o   h a r m   f o r 
 
                                                   / /   t h e   o t h e r s . 
 
 
 
                                                   / /   S t r i p   a n y   e m p t y   a r r a y   e l e m e n t s   ( c a u s e d   b y   d e l i m i t e r s ) 
 
                                                   / /   f r o m   t h e   b e g i n n i n g   o r   e n d   o f   t h e   a r r a y .   T h e y   w i l l 
 
                                                   / /   s t i l l   a p p e a r   i n   t h e   o u t p u t   s t r i n g   i f   i n   t h e   o u t p u t 
 
                                                   / /   f o r m a t . 
 
 
 
                                                   i f   ( i n p u t [ 0 ] ! = n u l l ) 
 
                                                         { i f   ( i n p u t [ 0 ] . l e n g t h = = 0 )                             { i n p u t . s p l i c e ( 0 , 1 ) ; } 
 
                                                           i f   ( i n p u t [ i n p u t . l e n g t h - 1 ] . l e n g t h = = 0 )   { i n p u t . s p l i c e ( i n p u t . l e n g t h - 1 , 1 ) ; } 
 
                                                         } 
 
 
 
                                                   c a l . f u l l I n p u t D a t e   =   f a l s e ; 
 
 
 
                                                   c a l . d a t e F o r m a t   =   c a l . d a t e F o r m a t . t o U p p e r C a s e ( ) ; 
 
 
 
                                                   / /   L i s t   a l l   t h e   a l l o w e d   l e t t e r s   i n   t h e   d a t e   f o r m a t 
 
                                                   v a r   t e m p l a t e   =   [ ' D ' , ' M ' , ' Y ' ] ; 
 
 
 
                                                   / /   P r e p a r e   t h e   s e q u e n c e   o f   d a t e   i n p u t   e l e m e n t s 
 
                                                   v a r   r e s u l t   =   n e w   A r r a y ( ) ; 
 
 
 
                                                   f o r   ( v a r   i = 0 ; i < t e m p l a t e . l e n g t h ; i + + ) 
 
                                                         { i f   ( c a l . d a t e F o r m a t . s e a r c h ( t e m p l a t e [ i ] ) > - 1 ) 
 
                                                                 { r e s u l t [ c a l . d a t e F o r m a t . s e a r c h ( t e m p l a t e [ i ] ) ]   =   t e m p l a t e [ i ] ; } 
 
                                                         } 
 
 
 
                                                   c a l . d a t e S e q u e n c e   =   r e s u l t . j o i n ( ' ' ) ; 
 
 
 
                                                   / /   S e p a r a t e   t h e   e l e m e n t s   o f   t h e   d a t e   i n p u t 
 
                                                   s w i t c h   ( i n p u t . l e n g t h ) 
 
                                                         { c a s e   1 : 
 
                                                                 { / /   Y e a r   o n l y   e n t r y   o r   u n d e l i m i t e d   d a t e   f o r m a t 
 
 
 
                                                                   i f   ( c a l . d a t e F o r m a t . i n d e x O f ( ' Y ' ) > - 1   & & 
 
                                                                           i n p u t [ 0 ] . l e n g t h > c a l . d a t e F o r m a t . l a s t I n d e x O f ( ' Y ' ) ) 
 
                                                                         { s e e d [ 0 ]   =   p a r s e I n t ( i n p u t [ 0 ] . s u b s t r i n g ( c a l . d a t e F o r m a t . i n d e x O f ( ' Y ' ) , 
 
                                                                                                                                                       c a l . d a t e F o r m a t . l a s t I n d e x O f ( ' Y ' ) + 1 ) , 1 0 ) ; 
 
                                                                         } 
 
                                                                   e l s e       { s e e d [ 0 ]   =   p a r s e I n t ( i n p u t [ 0 ] , 1 0 ) ; } 
 
 
 
                                                                   i f   ( c a l . d a t e F o r m a t . i n d e x O f ( ' M ' ) > - 1   & & 
 
                                                                           i n p u t [ 0 ] . l e n g t h > c a l . d a t e F o r m a t . l a s t I n d e x O f ( ' M ' ) ) 
 
                                                                         { s e e d [ 1 ]   =   i n p u t [ 0 ] . s u b s t r i n g ( c a l . d a t e F o r m a t . i n d e x O f ( ' M ' ) , 
 
                                                                                                                                     c a l . d a t e F o r m a t . l a s t I n d e x O f ( ' M ' ) + 1 ) ; 
 
                                                                         } 
 
                                                                   e l s e       { s e e d [ 1 ]   =   c a l . d e f a u l t T o C u r r e n t M o n t h ? ( d a t e N o w . g e t M o n t h ( ) + 1 ) . t o S t r i n g ( ) : ' 6 ' ; } 
 
 
 
                                                                   i f   ( c a l . d a t e F o r m a t . i n d e x O f ( ' D ' ) > - 1   & & 
 
                                                                           i n p u t [ 0 ] . l e n g t h > c a l . d a t e F o r m a t . l a s t I n d e x O f ( ' D ' ) ) 
 
                                                                         { s e e d [ 2 ]   =   p a r s e I n t ( i n p u t [ 0 ] . s u b s t r i n g ( c a l . d a t e F o r m a t . i n d e x O f ( ' D ' ) , 
 
                                                                                                                                                       c a l . d a t e F o r m a t . l a s t I n d e x O f ( ' D ' ) + 1 ) , 1 0 ) ; 
 
                                                                         } 
 
                                                                   e l s e       { s e e d [ 2 ]   =   1 ; } 
 
 
 
                                                                   i f   ( i n p u t [ 0 ] . l e n g t h = = c a l . d a t e F o r m a t . l e n g t h )         { c a l . f u l l I n p u t D a t e   =   t r u e ; } 
 
                                                                   b r e a k ; 
 
                                                                 } 
 
                                                           c a s e   2 : 
 
                                                                 { / /   Y e a r   a n d   M o n t h   e n t r y 
 
                                                                   s e e d [ 0 ]   =   p a r s e I n t ( i n p u t [ c a l . d a t e S e q u e n c e . r e p l a c e ( / D / i , ' ' ) . s e a r c h ( / Y / i ) ] , 1 0 ) ;     / /   Y e a r 
 
                                                                   s e e d [ 1 ]   =   i n p u t [ c a l . d a t e S e q u e n c e . r e p l a c e ( / D / i , ' ' ) . s e a r c h ( / M / i ) ] ;                               / /   M o n t h 
 
                                                                   s e e d [ 2 ]   =   1 ;                                                                                                                                                 / /   D a y 
 
                                                                   b r e a k ; 
 
                                                                 } 
 
                                                           c a s e   3 : 
 
                                                                 { / /   D a y   M o n t h   a n d   Y e a r   e n t r y 
 
                                                                   s e e d [ 0 ]   =   p a r s e I n t ( i n p u t [ c a l . d a t e S e q u e n c e . s e a r c h ( / Y / i ) ] , 1 0 ) ;     / /   Y e a r 
 
                                                                   s e e d [ 1 ]   =   i n p u t [ c a l . d a t e S e q u e n c e . s e a r c h ( / M / i ) ] ;                               / /   M o n t h 
 
                                                                   s e e d [ 2 ]   =   p a r s e I n t ( i n p u t [ c a l . d a t e S e q u e n c e . s e a r c h ( / D / i ) ] , 1 0 ) ;     / /   D a y 
 
                                                                   c a l . f u l l I n p u t D a t e   =   t r u e ; 
 
                                                                   b r e a k ; 
 
                                                                 } 
 
                                                           d e f a u l t : 
 
                                                                 { / /   A   s t u f f - u p   h a s   l e d   t o   m o r e   t h a n   t h r e e   e l e m e n t s   i n   t h e   d a t e . 
 
                                                                   s e e d [ 0 ]   =   0 ;           / /   Y e a r 
 
                                                                   s e e d [ 1 ]   =   0 ;           / /   M o n t h 
 
                                                                   s e e d [ 2 ]   =   0 ;           / /   D a y 
 
                                                                 } 
 
                                                         } 
 
 
 
                                                   / /   T h e s e   r e g u l a r   e x p r e s s i o n s   v a l i d a t e   t h e   i n p u t   d a t e   f o r m a t 
 
                                                   / /   t o   t h e   f o l l o w i n g   r u l e s ; 
 
                                                   / /                   D a y       1 - 3 1   ( o p t i o n a l   z e r o   o n   s i n g l e   d i g i t s ) 
 
                                                   / /                   M o n t h   1 - 1 2   ( o p t i o n a l   z e r o   o n   s i n g l e   d i g i t s ) 
 
                                                   / /                                           o r   c a s e   i n s e n s i t i v e   n a m e 
 
                                                   / /                   Y e a r     O n e ,   T w o   o r   f o u r   d i g i t s 
 
 
 
                                                   / /   M o n t h s   n a m e s   a r e   a s   s e t   i n   t h e   l a n g u a g e - d e p e n d e n t 
 
                                                   / /   d e f i n i t i o n s   a n d   d e l i m i t e r s   a r e   s e t   j u s t   b e l o w   t h e r e 
 
 
 
                                                   v a r   e x p V a l D a y         =   n e w   R e g E x p ( ' ^ ( 0 ? [ 1 - 9 ] | [ 1 - 2 ] [ 0 - 9 ] | 3 [ 0 - 1 ] ) $ ' ) , 
 
                                                           e x p V a l M o n t h     =   n e w   R e g E x p ( ' ^ ( 0 ? [ 1 - 9 ] | 1 [ 0 - 2 ] | ' + c a l . m o n t h N a m e s . j o i n ( ' | ' ) + ' ) $ ' , ' i ' ) , 
 
                                                           e x p V a l Y e a r       =   n e w   R e g E x p ( ' ^ ( [ 0 - 9 ] { 1 , 2 } | [ 0 - 9 ] { 4 } ) $ ' ) ; 
 
 
 
                                                   / /   A p p l y   v a l i d a t i o n   a n d   r e p o r t   f a i l u r e s 
 
 
 
                                                   i f   ( e x p V a l Y e a r . e x e c ( s e e d [ 0 ] )   = = n u l l   | | 
 
                                                           e x p V a l M o n t h . e x e c ( s e e d [ 1 ] ) = = n u l l   | | 
 
                                                           e x p V a l D a y . e x e c ( s e e d [ 2 ] )     = = n u l l 
 
                                                         ) 
 
                                                         { i f   ( c a l . s h o w I n v a l i d D a t e M s g ) 
 
                                                                 { a l e r t ( c a l . i n v a l i d D a t e M s g   +   c a l . i n v a l i d A l e r t [ 0 ]   +   d a t e V a l u e   +   c a l . i n v a l i d A l e r t [ 1 ] ) ; } 
 
                                                           s e e d [ 0 ]   =   c a l . b a s e Y e a r   +   M a t h . f l o o r ( c a l . d r o p D o w n Y e a r s / 2 ) ;                                       / /   Y e a r 
 
                                                           s e e d [ 1 ]   =   c a l . d e f a u l t T o C u r r e n t M o n t h ? ( d a t e N o w . g e t M o n t h ( ) + 1 ) . t o S t r i n g ( ) : ' 6 ' ;     / /   M o n t h 
 
                                                           s e e d [ 2 ]   =   1 ;                                                                                                                                 / /   D a y 
 
                                                           c a l . f u l l I n p u t D a t e   =   f a l s e ; 
 
                                                         } 
 
 
 
                                                   / /   R e t u r n   t h e   Y e a r     i n   s e e d [ 0 ] 
 
                                                   / /                         M o n t h   i n   s e e d [ 1 ] 
 
                                                   / /                         D a y       i n   s e e d [ 2 ] 
 
 
 
                                                   r e t u r n   s e e d ; 
 
                                                 } ; 
 
 
 
                                           / /   P a r s e   t h e   s t r i n g   i n t o   a n   a r r a y   u s i n g   t h e   a l l o w e d   d e l i m i t e r s 
 
 
 
                                           s e e d D a t e   =   i n p u t F o r m a t ( ) ; 
 
 
 
                                           / /   S o   n o w   w e   h a v e   t h e   Y e a r ,   M o n t h   a n d   D a y   i n   a n   a r r a y . 
 
 
 
                                           / /       I f   t h e   y e a r   i s   o n e   o r   t w o   d i g i t s   t h e n   t h e   r o u t i n e   a s s u m e s   a 
 
                                           / /       y e a r   b e l o n g s   i n   t h e   2 1 s t   C e n t u r y   u n l e s s   i t   i s   l e s s   t h a n   5 0 
 
                                           / /       i n   w h i c h   c a s e   i t   a s s u m e s   t h e   2 0 t h   C e n t u r y   i s   i n t e n d e d . 
 
 
 
                                           i f   ( s e e d D a t e [ 0 ] < 1 0 0 )   { s e e d D a t e [ 0 ]   + =   ( s e e d D a t e [ 0 ] > 5 0 ) ? 1 9 0 0 : 2 0 0 0 ; } 
 
 
 
                                           / /   C h e c k   w h e t h e r   t h e   m o n t h   i s   i n   d i g i t s   o r   a n   a b b r e v i a t i o n 
 
 
 
                                           i f   ( s e e d D a t e [ 1 ] . s e a r c h ( / \ d + / ) < 0 ) 
 
                                                 { f o r   ( i = 0 ; i < c a l . m o n t h N a m e s . l e n g t h ; i + + ) 
 
                                                         { i f   ( s e e d D a t e [ 1 ] . t o U p p e r C a s e ( ) = = c a l . m o n t h N a m e s [ i ] . t o U p p e r C a s e ( ) ) 
 
                                                                 { s e e d D a t e [ 1 ] = i + 1 ; 
 
                                                                   b r e a k ; 
 
                                                                 } 
 
                                                         } 
 
                                                 } 
 
 
 
                                           c a l . s e e d D a t e   =   n e w   D a t e ( s e e d D a t e [ 0 ] , s e e d D a t e [ 1 ] - 1 , s e e d D a t e [ 2 ] ) ; 
 
                                         } 
 
 
 
                                   / /   T e s t   t h a t   w e   h a v e   a r r i v e d   a t   a   v a l i d   d a t e 
 
 
 
                                   i f   ( i s N a N ( c a l . s e e d D a t e ) ) 
 
                                         { i f   ( c a l . s h o w I n v a l i d D a t e M s g ) 
 
                                                 { a l e r t ( c a l . i n v a l i d D a t e M s g   +   c a l . i n v a l i d A l e r t [ 0 ]   +   d a t e V a l u e   +   c a l . i n v a l i d A l e r t [ 1 ] ) ; } 
 
                                           c a l . s e e d D a t e   =   n e w   D a t e ( c a l . b a s e Y e a r   +   M a t h . f l o o r ( c a l . d r o p D o w n Y e a r s / 2 ) , 5 , 1 ) ; 
 
                                           c a l . f u l l I n p u t D a t e   =   f a l s e ; 
 
                                         } 
 
                                   e l s e 
 
                                         { / /   T e s t   t h a t   t h e   d a t e   i s   w i t h i n   r a n g e , 
 
                                           / /   i f   n o t   t h e n   s e t   d a t e   t o   a   s e n s i b l e   d a t e   i n   r a n g e . 
 
 
 
                                           i f   ( ( n e w   D a t e ( c a l . b a s e Y e a r , 0 , 1 ) ) > c a l . s e e d D a t e ) 
 
                                                 { i f   ( c a l . s t r i c t   & &   c a l . s h o w O u t O f R a n g e M s g )   { a l e r t ( c a l . o u t O f R a n g e M s g ) ; } 
 
                                                   c a l . s e e d D a t e   =   n e w   D a t e ( c a l . b a s e Y e a r , 0 , 1 ) ; 
 
                                                   c a l . f u l l I n p u t D a t e = f a l s e ; 
 
                                                 } 
 
                                           e l s e 
 
                                                 { i f   ( ( n e w   D a t e ( c a l . b a s e Y e a r + c a l . d r o p D o w n Y e a r s , 0 , 0 ) ) < c a l . s e e d D a t e ) 
 
                                                         { i f   ( c a l . s t r i c t   & &   c a l . s h o w O u t O f R a n g e M s g )   { a l e r t ( c a l . o u t O f R a n g e M s g ) ; } 
 
                                                           c a l . s e e d D a t e   =   n e w   D a t e ( c a l . b a s e Y e a r   +   M a t h . f l o o r ( c a l . d r o p D o w n Y e a r s ) , - 1 , 1 ) ; 
 
                                                           c a l . f u l l I n p u t D a t e = f a l s e ; 
 
                                                         } 
 
                                                   e l s e 
 
                                                         { i f   ( c a l . s t r i c t   & &   c a l . f u l l I n p u t D a t e   & & 
 
                                                                     ( c a l . s e e d D a t e . g e t D a t e ( )           ! = s e e d D a t e [ 2 ]   | | 
 
                                                                       ( c a l . s e e d D a t e . g e t M o n t h ( ) + 1 ) ! = s e e d D a t e [ 1 ]   | | 
 
                                                                       c a l . s e e d D a t e . g e t F u l l Y e a r ( )   ! = s e e d D a t e [ 0 ] 
 
                                                                     ) 
 
                                                                 ) 
 
                                                                 { i f   ( c a l . s h o w D o e s N o t E x i s t M s g )   { a l e r t ( c a l . d o e s N o t E x i s t M s g ) ; } 
 
                                                                   c a l . s e e d D a t e   =   n e w   D a t e ( c a l . s e e d D a t e . g e t F u l l Y e a r ( ) , c a l . s e e d D a t e . g e t M o n t h ( ) - 1 , 1 ) ; 
 
                                                                   c a l . f u l l I n p u t D a t e = f a l s e ; 
 
                                                                 } 
 
                                                         } 
 
                                                 } 
 
                                         } 
 
 
 
                                   / /   T e s t   t h e   c h o s e n   d a t e s   f o r   v a l i d i t y 
 
                                   / /   G i v e   e r r o r   m e s s a g e   i f   n o t   v a l i d 
 
 
 
                                   f o r   ( v a r   i = 0 ; i < c a l . d a t e s . l e n g t h ; i + + ) 
 
                                         { i f   ( ! ( ( t y p e o f   c a l . d a t e s [ i ] = = ' o b j e c t ' )   & &   ( c a l . d a t e s [ i ] . c o n s t r u c t o r = = D a t e ) ) ) 
 
                                                 { i f   ( ( t y p e o f   c a l . d a t e s [ i ] = = ' o b j e c t ' )   & &   ( c a l . d a t e s [ i ] . c o n s t r u c t o r = = A r r a y ) ) 
 
                                                         { v a r   p a s s   =   t r u e ; 
 
 
 
                                                           i f   ( c a l . d a t e s [ i ] . l e n g t h ! = 2 ) 
 
                                                                 { i f   ( c a l . s h o w R a n g e S e t t i n g E r r o r ) 
 
                                                                         { a l e r t ( c a l . r a n g e S e t t i n g E r r o r [ 0 ]   +   c a l . d a t e s [ i ]   +   c a l . r a n g e S e t t i n g E r r o r [ 1 ] ) ; } 
 
                                                                   p a s s   =   f a l s e ; 
 
                                                                 } 
 
                                                           e l s e 
 
                                                                 { f o r   ( v a r   j = 0 ; j < c a l . d a t e s [ i ] . l e n g t h ; j + + ) 
 
                                                                         i f   ( ! ( ( t y p e o f   c a l . d a t e s [ i ] [ j ] = = ' o b j e c t ' )   & &   ( c a l . d a t e s [ i ] [ j ] . c o n s t r u c t o r = = D a t e ) ) ) 
 
                                                                                 { i f   ( c a l . s h o w R a n g e S e t t i n g E r r o r ) 
 
                                                                                         { a l e r t ( c a l . d a t e S e t t i n g E r r o r [ 0 ]   +   c a l . d a t e s [ i ] [ j ]   +   c a l . d a t e S e t t i n g E r r o r [ 1 ] ) ; } 
 
                                                                                   p a s s   =   f a l s e ; 
 
                                                                                 } 
 
                                                                 } 
 
 
 
                                                           i f   ( p a s s   & &   ( c a l . d a t e s [ i ] [ 0 ] > c a l . d a t e s [ i ] [ 1 ] ) )   { c a l . d a t e s [ i ] . r e v e r s e ( ) ; } 
 
                                                         } 
 
                                                   e l s e 
 
                                                         { i f   ( c a l . s h o w R a n g e S e t t i n g E r r o r ) 
 
                                                                 { a l e r t ( c a l . d a t e S e t t i n g E r r o r [ 0 ]   +   c a l . d a t e s [ i ]   +   c a l . d a t e S e t t i n g E r r o r [ 1 ] ) ; } 
 
                                                         } 
 
                                                 } 
 
                                         } 
 
 
 
                                   / /   S e t   l a n g u a g e - d e p e n d e n t   v a l u e s 
 
 
 
                                   g e t E l ( c a l I d + ' D r a g T e x t ' ) . i n n e r H T M L   =   c a l . d r a g ; 
 
 
 
                                   v a r   m o n t h O p t i o n s   =   g e t E l ( c a l I d + ' M o n t h s ' ) . o p t i o n s ,     m o n t h s   =   ' ' ; 
 
 
 
                                   i f   ( m o n t h O p t i o n s . l e n g t h > 0 )   { f o r   ( v a r   i = 0 ; i < m o n t h O p t i o n s . l e n g t h ; i + + )   { m o n t h s   + =   m o n t h O p t i o n s [ i ] . v a l u e + ' , ' ; } } 
 
 
 
                                   i f   ( m o n t h O p t i o n s . l e n g t h = = 0   | |   ( c a l . m o n t h N a m e s . j o i n ( ) + ' , ' ) ! = m o n t h s ) 
 
                                         { m o n t h O p t i o n s . l e n g t h   =   0 ; 
 
 
 
                                           i f   ( c a l . m o n t h N a m e s . l e n g t h < m o n t h O p t i o n s . l e n g t h )   { m o n t h O p t i o n s . l e n g t h   =   c a l . m o n t h N a m e s . l e n g t h ; } 
 
 
 
                                           f o r   ( v a r   i = 0 ; i < c a l . m o n t h N a m e s . l e n g t h ; i + + ) 
 
                                                 { i f   ( i > m o n t h O p t i o n s . l e n g t h - 1 ) 
 
                                                             { m o n t h O p t i o n s [ i ]   =   n e w   O p t i o n ( c a l . m o n t h N a m e s [ i ] , c a l . m o n t h N a m e s [ i ] ) ; } 
 
                                                   e l s e   { m o n t h O p t i o n s [ i ] . i n n e r H T M L   =   c a l . m o n t h N a m e s [ i ] ; } 
 
                                                 } 
 
                                         } 
 
 
 
                                   f o r   ( v a r   i = 0 ; i < c a l . w e e k I n i t s . l e n g t h ; i + + ) 
 
                                         { g e t E l ( c a l I d + ' W e e k I n i t ' + i ) . i n n e r H T M L   =   c a l . w e e k I n i t s [ ( i + c a l . w e e k S t a r t ) % c a l . w e e k I n i t s . l e n g t h ] ; } 
 
 
 
                                   i f   ( ( ( n e w   D a t e ( c a l . b a s e Y e a r   +   c a l . d r o p D o w n Y e a r s ,   0 ,   0 ) )   >   d a t e N o w   & & 
 
                                             ( n e w   D a t e ( c a l . b a s e Y e a r ,   0 ,   0 ) )                                           <   d a t e N o w )   | | 
 
                                           ( c a l . c l e a r B u t t o n   & &   ( e l e . r e a d O n l y   | |   e l e . d i s a b l e d ) ) 
 
                                         )       { g e t E l ( c a l I d + ' N o w ' ) . i n n e r H T M L   =   c a l . t o d a y + '   ' + d a t e N o w . j a c s F o r m a t ( c a l . d a t e D i s p l a y F o r m a t , c a l . m o n t h N a m e s ) ; 
 
                                                   g e t E l ( c a l I d + ' C l e a r B u t t o n ' ) . v a l u e       =   c a l . c l e a r ; 
 
                                                   g e t E l ( c a l I d + ' F o o t ' ) . s t y l e . d i s p l a y   =   ' ' ; 
 
 
 
                                                   i f   ( ( n e w   D a t e ( c a l . b a s e Y e a r   +   c a l . d r o p D o w n Y e a r s ,   0 ,   0 ) )   >   d a t e N o w   & & 
 
                                                           ( n e w   D a t e ( c a l . b a s e Y e a r ,   0 ,   0 ) )                                           <   d a t e N o w ) 
 
                                                                 { g e t E l ( c a l I d + ' N o w ' ) . s t y l e . d i s p l a y   =   ' ' ; 
 
                                                                   i f   ( c a l . c l e a r B u t t o n   & &   ( e l e . r e a d O n l y   | |   e l e . d i s a b l e d ) ) 
 
                                                                                 { g e t E l ( c a l I d + ' C l e a r ' ) . s t y l e . d i s p l a y       =   ' ' ; 
 
                                                                                   g e t E l ( c a l I d + ' C l e a r ' ) . s t y l e . t e x t A l i g n   =   ' l e f t ' ; 
 
                                                                                   g e t E l ( c a l I d + ' N o w '     ) . s t y l e . t e x t A l i g n   =   ' r i g h t ' ; 
 
                                                                                 } 
 
                                                                   e l s e       { g e t E l ( c a l I d + ' C l e a r ' ) . s t y l e . d i s p l a y       =   ' n o n e ' ; 
 
                                                                                   g e t E l ( c a l I d + ' N o w '     ) . s t y l e . t e x t A l i g n   =   ' c e n t e r ' ; 
 
                                                                                 } 
 
                                                                 } 
 
                                                   e l s e       { g e t E l ( c a l I d + ' C l e a r ' ) . s t y l e . t e x t A l i g n   =   ' c e n t e r ' ; 
 
                                                                   g e t E l ( c a l I d + ' C l e a r ' ) . s t y l e . d i s p l a y       =   ' ' ; 
 
                                                                   g e t E l ( c a l I d + ' N o w '     ) . s t y l e . d i s p l a y       =   ' n o n e ' ; 
 
                                                                 } 
 
                                                 } 
 
                                   e l s e       { g e t E l ( c a l I d + ' F o o t ' ) . s t y l e . d i s p l a y   =   ' n o n e ' ; } 
 
 
 
                                   / /   C a l c u l a t e   t h e   n u m b e r   o f   m o n t h s   t h a t   t h e   e n t e r e d   ( o r 
 
                                   / /   d e f a u l t e d )   m o n t h   i s   a f t e r   t h e   s t a r t   o f   t h e   a l l o w e d 
 
                                   / /   d a t e   r a n g e . 
 
                                   c a l . m o n t h S u m   =     1 2 * ( c a l . s e e d D a t e . g e t F u l l Y e a r ( )   -   c a l . b a s e Y e a r )   +   c a l . s e e d D a t e . g e t M o n t h ( ) ; 
 
 
 
                                   / /   S e t   t h e   d r o p   d o w n   b o x e s . 
 
                                   g e t E l ( c a l I d + ' Y e a r s ' ) . o p t i o n s . s e l e c t e d I n d e x     =   M a t h . f l o o r ( c a l . m o n t h S u m / 1 2 ) ; 
 
                                   g e t E l ( c a l I d + ' M o n t h s ' ) . o p t i o n s . s e l e c t e d I n d e x   =   ( c a l . m o n t h S u m % 1 2 ) ; 
 
 
 
                                   g e t E l ( c a l I d ) . e l e   =   e l e ; 
 
 
 
                                   / /   D i s p l a y   t h e   m o n t h 
 
                                   s h o w M o n t h ( 0 , c a l I d ) ; 
 
 
 
                                   / /   R e m e m b e r   t h e   E l e m e n t 
 
                                   c a l . t a r g e t E l e   =   e l e ; 
 
 
 
                                   / /   P o s i t i o n   t h e   c a l e n d a r   b o x . 
 
                                   i f   ( d y n a m i c ) 
 
                                         { / /   C h e c k   w h e t h e r   o r   n o t   d r a g g i n g   i s   a l l o w e d   a n d   d i s p l a y   d r a g   h a n d l e   i f   n e c e s s a r y 
 
                                           g e t E l ( c a l I d + ' D r a g ' ) . s t y l e . d i s p l a y   =   ( c a l . a l l o w D r a g ) ? ' ' : ' n o n e ' ; 
 
 
 
                                           v a r   o f f s e t T o p     =   p a r s e I n t ( e l e . o f f s e t T o p   , 1 0 ) , 
 
                                                   o f f s e t L e f t   =   p a r s e I n t ( e l e . o f f s e t L e f t , 1 0 ) ; 
 
 
 
                                           / /   T h e   o b j e c t   s n i f f i n g   f o r   O p e r a   a l l o w s   f o r   t h e   f a c t   t h a t   O p e r a 
 
                                           / /   i s   t h e   o n l y   m a j o r   b r o w s e r   t h a t   c o r r e c t l y   r e p o r t s   t h e   p o s i t i o n 
 
                                           / /   o f   a n   e l e m e n t   i n   a   s c r o l l a b l e   D I V .     T h i s   i s   b e c a u s e   I E   a n d 
 
                                           / /   F i r e f o x   o m i t   t h e   D I V   f r o m   t h e   o f f s e t P a r e n t   t r e e . 
 
                                           i f   ( ! w i n d o w . o p e r a ) 
 
                                                   { w h i l e   ( e l e . t a g N a m e ! = ' B O D Y '   & &   e l e . t a g N a m e ! = ' H T M L ' ) 
 
                                                           { o f f s e t T o p     - =   p a r s e I n t ( e l e . s c r o l l T o p ,   1 0 ) ; 
 
                                                             o f f s e t L e f t   - =   p a r s e I n t ( e l e . s c r o l l L e f t , 1 0 ) ; 
 
                                                             e l e   =   e l e . p a r e n t N o d e ; 
 
                                                           } 
 
                                                     e l e   =   c a l . t a r g e t E l e ; 
 
                                                   } 
 
 
 
                                           w h i l e   ( e l e . t a g N a m e ! = ' B O D Y '   & &   e l e . t a g N a m e ! = ' H T M L ' ) 
 
                                                 { e l e   =   e l e . o f f s e t P a r e n t ; 
 
                                                   o f f s e t T o p     + =   p a r s e I n t ( e l e . o f f s e t T o p ,   1 0 ) ; 
 
                                                   o f f s e t L e f t   + =   p a r s e I n t ( e l e . o f f s e t L e f t , 1 0 ) ; 
 
                                                 } 
 
 
 
                                           e l e   =   c a l . t a r g e t E l e ; 
 
 
 
                                           v a r   e l e O f f s e t T o p     =   o f f s e t T o p , 
 
                                                   e l e O f f s e t L e f t   =   o f f s e t L e f t ; 
 
 
 
                                           i f   ( c a l . x B a s e . l e n g t h > 0 ) 
 
                                                         { i f   ( i s N a N ( c a l . x B a s e ) ) 
 
                                                                         { c a l . x B a s e   =   c a l . x B a s e . t o U p p e r C a s e ( ) ; 
 
                                                                           o f f s e t L e f t   + =   ( c a l . x B a s e = = ' R ' ) 
 
                                                                                                                 ? p a r s e I n t ( e l e . o f f s e t W i d t h , 1 0 ) 
 
                                                                                                                 : ( c a l . x B a s e = = ' M ' ) ? M a t h . r o u n d ( p a r s e I n t ( e l e . o f f s e t W i d t h , 1 0 ) / 2 ) : 0 ; 
 
                                                                         } 
 
                                                           e l s e       { o f f s e t L e f t   + =   p a r s e I n t ( c a l . x B a s e , 1 0 ) ; } 
 
                                                         } 
 
 
 
                                           i f   ( c a l . y B a s e . l e n g t h > 0 ) 
 
                                                         { i f   ( i s N a N ( c a l . y B a s e ) ) 
 
                                                                         { c a l . y B a s e     =   c a l . y B a s e . t o U p p e r C a s e ( ) ; 
 
                                                                           o f f s e t T o p   + =   ( c a l . y B a s e = = ' B ' ) 
 
                                                                                                         ? p a r s e I n t ( e l e . o f f s e t H e i g h t , 1 0 ) 
 
                                                                                                         : ( c a l . y B a s e = = ' M ' ) ? M a t h . r o u n d ( p a r s e I n t ( e l e . o f f s e t H e i g h t , 1 0 ) / 2 ) : 0 ; 
 
                                                                         } 
 
                                                           e l s e       { o f f s e t T o p   + =   p a r s e I n t ( c a l . y B a s e , 1 0 ) ; } 
 
                                                         } 
 
                                           e l s e       { o f f s e t T o p   + =   p a r s e I n t ( e l e . o f f s e t H e i g h t , 1 0 ) ; } 
 
 
 
                                           i f   ( c a l . x P o s i t i o n . l e n g t h > 0 ) 
 
                                                         { i f   ( i s N a N ( c a l . x P o s i t i o n ) ) 
 
                                                                         { c a l . x P o s i t i o n   =   c a l . x P o s i t i o n . t o U p p e r C a s e ( ) ; 
 
                                                                           o f f s e t L e f t   - =   ( c a l . x P o s i t i o n = = ' R ' ) 
 
                                                                                                                 ? p a r s e I n t ( c a l . o f f s e t W i d t h , 1 0 ) 
 
                                                                                                                 : ( c a l . x P o s i t i o n = = ' M ' ) ? M a t h . r o u n d ( p a r s e I n t ( c a l . o f f s e t W i d t h , 1 0 ) / 2 ) : 0 ; 
 
                                                                         } 
 
                                                           e l s e       { o f f s e t L e f t   + =   p a r s e I n t ( c a l . x P o s i t i o n , 1 0 ) ; } 
 
                                                         } 
 
 
 
                                           i f   ( c a l . y P o s i t i o n . l e n g t h > 0 ) 
 
                                                         { i f   ( i s N a N ( c a l . y P o s i t i o n ) ) 
 
                                                                         { c a l . y P o s i t i o n   =   c a l . y P o s i t i o n . t o U p p e r C a s e ( ) ; 
 
 
 
                                                                           o f f s e t T o p   - =   ( c a l . y P o s i t i o n = = ' B ' ) 
 
                                                                                                                 ? p a r s e I n t ( c a l . o f f s e t H e i g h t , 1 0 ) 
 
                                                                                                                 : ( c a l . y P o s i t i o n = = ' M ' ) ? M a t h . r o u n d ( ( p a r s e I n t ( c a l . o f f s e t H e i g h t , 1 0 ) ) / 2 ) : 0 ; 
 
                                                                         } 
 
                                                           e l s e       { o f f s e t T o p   + =   p a r s e I n t ( c a l . y P o s i t i o n , 1 0 ) ; } 
 
                                                         } 
 
 
 
                                           i f   ( c a l . a u t o P o s i t i o n ) 
 
                                                 { v a r   w i d t h             =   p a r s e I n t ( c a l . o f f s e t W i d t h ,   1 0 ) , 
 
                                                           h e i g h t           =   p a r s e I n t ( c a l . o f f s e t H e i g h t , 1 0 ) , 
 
                                                           w i n d o w L e f t   = 
 
                                                                   ( d o c u m e n t . b o d y   & &   d o c u m e n t . b o d y . s c r o l l L e f t ) 
 
                                                                             ? d o c u m e n t . b o d y . s c r o l l L e f t                                     / / D O M   c o m p l i a n t 
 
                                                                             : ( d o c u m e n t . d o c u m e n t E l e m e n t   & &   d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l L e f t ) 
 
                                                                                     ? d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l L e f t       / / I E 6 +   s t a n d a r d s   c o m p l i a n t 
 
                                                                                     : 0 ,                                                                         / / F a i l e d 
 
                                                           w i n d o w W i d t h   = 
 
                                                                     ( t y p e o f ( i n n e r W i d t h )   = =   ' n u m b e r ' ) 
 
                                                                             ? i n n e r W i d t h                                                                 / / D O M   c o m p l i a n t 
 
                                                                             : ( d o c u m e n t . d o c u m e n t E l e m e n t   & &   d o c u m e n t . d o c u m e n t E l e m e n t . c l i e n t W i d t h ) 
 
                                                                                     ? d o c u m e n t . d o c u m e n t E l e m e n t . c l i e n t W i d t h     / / I E 6 +   s t a n d a r d s   c o m p l i a n t 
 
                                                                                     : ( d o c u m e n t . b o d y   & &   d o c u m e n t . b o d y . c l i e n t W i d t h ) 
 
                                                                                             ? d o c u m e n t . b o d y . c l i e n t W i d t h                   / / I E   n o n - c o m p l i a n t 
 
                                                                                             : 0 ,                                                                 / / F a i l e d 
 
                                                           w i n d o w T o p   = 
 
                                                                     ( d o c u m e n t . b o d y   & &   d o c u m e n t . b o d y . s c r o l l T o p ) 
 
                                                                             ? d o c u m e n t . b o d y . s c r o l l T o p                                       / / D O M   c o m p l i a n t 
 
                                                                             : ( d o c u m e n t . d o c u m e n t E l e m e n t   & &   d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l T o p ) 
 
                                                                                     ? d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l T o p         / / I E 6 +   s t a n d a r d s   c o m p l i a n t 
 
                                                                                     : 0 ,                                                                         / / F a i l e d 
 
                                                           w i n d o w H e i g h t   = 
 
                                                                     ( t y p e o f ( i n n e r H e i g h t )   = =   ' n u m b e r ' ) 
 
                                                                             ? i n n e r H e i g h t                                                               / / D O M   c o m p l i a n t 
 
                                                                             : ( d o c u m e n t . d o c u m e n t E l e m e n t   & &   d o c u m e n t . d o c u m e n t E l e m e n t . c l i e n t H e i g h t ) 
 
                                                                                     ? d o c u m e n t . d o c u m e n t E l e m e n t . c l i e n t H e i g h t   / / I E 6 +   s t a n d a r d s   c o m p l i a n t 
 
                                                                                     : ( d o c u m e n t . b o d y   & &   d o c u m e n t . b o d y . c l i e n t H e i g h t ) 
 
                                                                                             ? d o c u m e n t . b o d y . c l i e n t H e i g h t                 / / I E   n o n - c o m p l i a n t 
 
                                                                                             : 0 ;                                                                 / / F a i l e d 
 
 
 
                                                   i f   ( e l e O f f s e t L e f t   +   p a r s e I n t ( e l e . o f f s e t W i d t h , 1 0 )   -   w i d t h   > =   w i n d o w L e f t   & & 
 
                                                           o f f s e t L e f t   +   w i d t h   >   w i n d o w L e f t   +   w i n d o w W i d t h 
 
                                                         )               { o f f s e t L e f t   =   e l e O f f s e t L e f t   +   p a r s e I n t ( e l e . o f f s e t W i d t h , 1 0 )   -   w i d t h ; } 
 
                                                   e l s e   i f   ( e l e O f f s e t L e f t   > =   w i n d o w L e f t   & &   o f f s e t L e f t   <   w i n d o w L e f t 
 
                                                                   )     { o f f s e t L e f t   =   e l e O f f s e t L e f t ; } 
 
 
 
                                                   i f   ( e l e O f f s e t T o p   -   h e i g h t   > =   w i n d o w T o p   & & 
 
                                                           o f f s e t T o p   +   h e i g h t   >   w i n d o w T o p   +   w i n d o w H e i g h t 
 
                                                         )               { o f f s e t T o p   =   e l e O f f s e t T o p   -   h e i g h t ; } 
 
                                                   e l s e   i f   ( o f f s e t T o p   +   h e i g h t   < =   w i n d o w T o p   +   w i n d o w H e i g h t   & &   o f f s e t T o p   <   w i n d o w T o p ) 
 
                                                                         { o f f s e t T o p   =   e l e O f f s e t T o p   +   p a r s e I n t ( e l e . o f f s e t H e i g h t , 1 0 ) ; } 
 
                                                 } 
 
 
 
                                           c a l . s t y l e . t o p     =   o f f s e t T o p + ' p x ' ; 
 
                                           c a l . s t y l e . l e f t   =   o f f s e t L e f t + ' p x ' ; 
 
 
 
                                           g e t E l ( c a l I d + ' I f r a m e ' ) . s t y l e . t o p         =   o f f s e t T o p   + ' p x ' ; 
 
                                           g e t E l ( c a l I d + ' I f r a m e ' ) . s t y l e . l e f t       =   o f f s e t L e f t + ' p x ' ; 
 
 
 
                                           g e t E l ( c a l I d + ' I f r a m e ' ) . s t y l e . w i d t h     =   ( c a l . o f f s e t W i d t h   - ( g e t E l ( ' j a c s I E ' ) ? 2 : 4 ) ) + ' p x ' ; 
 
                                           g e t E l ( c a l I d + ' I f r a m e ' ) . s t y l e . h e i g h t   =   ( c a l . o f f s e t H e i g h t - ( g e t E l ( ' j a c s I E ' ) ? 2 : 4 ) ) + ' p x ' ; 
 
                                           g e t E l ( c a l I d + ' I f r a m e ' ) . s t y l e . v i s i b i l i t y   =   ' i n h e r i t ' ; 
 
                                         } 
 
 
 
                                   / /   S h o w   i t   o n   t h e   p a g e 
 
                                   c a l . s t y l e . v i s i b i l i t y   =   ' i n h e r i t ' ; 
 
                                 } , 
 
 
 
                           m a k e :   f u n c t i o n   ( c a l I d ) 
 
                                 { c a l s . p u s h ( c a l I d ) ; 
 
 
 
                                   v a r   d y n a m i c   =   ( t y p e o f   a r g u m e n t s [ 1 ] = = ' b o o l e a n ' ) ? a r g u m e n t s [ 1 ] : t r u e ; 
 
 
 
                                   T A B L E j a c s                       =   d o c u m e n t . c r e a t e E l e m e n t ( ' t a b l e ' ) ; 
 
                                   T A B L E j a c s . i d                 =   c a l I d ; 
 
                                   T A B L E j a c s . d y n a m i c       =   d y n a m i c ; 
 
                                   T A B L E j a c s . c l a s s N a m e   =   ( d y n a m i c ) ? ' j a c s ' : ' j a c s S t a t i c ' ; 
 
 
 
                                   c a l A t t r i b u t e s ( T A B L E j a c s ) ; 
 
 
 
                                   i f   ( d y n a m i c )   { T A B L E j a c s . s t y l e . z I n d e x   =   T A B L E j a c s . z I n d e x + 1 ; } 
 
 
 
                                   f u n c t i o n   c a n c e l ( e v t ) 
 
                                         { i f   ( T A B L E j a c s . c l i c k T o H i d e )   { h i d e ( c a l I d ) ; } 
 
                                           s t o p P r o p a g a t i o n ( e v t ) ; 
 
                                         } ; 
 
 
 
                                   T B O D Y j a c s                                   =   d o c u m e n t . c r e a t e E l e m e n t ( ' t b o d y ' ) ; 
 
                                   T R j a c s 1                                       =   d o c u m e n t . c r e a t e E l e m e n t ( ' t r ' ) ; 
 
                                   T R j a c s 1 . c l a s s N a m e                   =   ' j a c s ' ; 
 
                                   T D j a c s 1                                       =   d o c u m e n t . c r e a t e E l e m e n t ( ' t d ' ) ; 
 
                                   T D j a c s 1 . c l a s s N a m e                   =   ' j a c s ' ; 
 
                                   T A B L E j a c s H e a d                           =   d o c u m e n t . c r e a t e E l e m e n t ( ' t a b l e ' ) ; 
 
                                   T A B L E j a c s H e a d . i d                     =   c a l I d + ' H e a d ' ; 
 
                                   T A B L E j a c s H e a d . c e l l S p a c i n g   =   ' 0 ' ; 
 
                                   T A B L E j a c s H e a d . c e l l P a d d i n g   =   ' 0 ' ; 
 
                                   T A B L E j a c s H e a d . c l a s s N a m e       =   ' j a c s H e a d ' ; 
 
                                   T A B L E j a c s H e a d . w i d t h               =   ' 1 0 0 % ' ; 
 
 
 
                                   T B O D Y j a c s H e a d                           =   d o c u m e n t . c r e a t e E l e m e n t ( ' t b o d y ' ) ; 
 
 
 
                                   T R j a c s D r a g                                 =   d o c u m e n t . c r e a t e E l e m e n t ( ' t r ' ) ; 
 
                                   T R j a c s D r a g . i d                           =   c a l I d + ' D r a g ' ; 
 
                                   T R j a c s D r a g . s t y l e . d i s p l a y     =   ' n o n e ' ; 
 
 
 
                                   T D j a c s D r a g                                 =   d o c u m e n t . c r e a t e E l e m e n t ( ' t d ' ) ; 
 
                                   T D j a c s D r a g . c l a s s N a m e             =   ' j a c s D r a g ' ; 
 
                                   T D j a c s D r a g . c o l S p a n                 =   ' 4 ' ; 
 
 
 
                                   f u n c t i o n   b e g i n D r a g ( e v t ) 
 
                                         { v a r   e l T o D r a g   =   g e t E l ( c a l I d ) ; 
 
 
 
                                           v a r   d e l t a X         =   e v t . c l i e n t X , 
 
                                                   d e l t a Y         =   e v t . c l i e n t Y , 
 
                                                   o f f s e t E l e   =   e l T o D r a g ; 
 
 
 
                                           w h i l e   ( o f f s e t E l e . t a g N a m e ! = ' B O D Y '   & &   o f f s e t E l e . t a g N a m e ! = ' H T M L ' ) 
 
                                                 { d e l t a X       - =   p a r s e I n t ( o f f s e t E l e . o f f s e t L e f t , 1 0 ) ; 
 
                                                   d e l t a Y       - =   p a r s e I n t ( o f f s e t E l e . o f f s e t T o p   , 1 0 ) ; 
 
                                                   o f f s e t E l e   =   o f f s e t E l e . o f f s e t P a r e n t ; 
 
                                                 } 
 
 
 
                                           i f   ( d o c u m e n t . a d d E v e n t L i s t e n e r ) 
 
                                                         { e l T o D r a g . a d d E v e n t L i s t e n e r ( ' m o u s e m o v e ' , m o v e H a n d l e r , t r u e ) ; 
 
                                                           e l T o D r a g . a d d E v e n t L i s t e n e r ( ' m o u s e u p ' ,         u p H a n d l e r , t r u e ) ; 
 
                                                         } 
 
                                           e l s e       { e l T o D r a g . a t t a c h E v e n t ( ' o n m o u s e m o v e ' ,   m o v e H a n d l e r ) ; 
 
                                                           e l T o D r a g . a t t a c h E v e n t ( ' o n m o u s e u p ' ,           u p H a n d l e r ) ; 
 
                                                           e l T o D r a g . s e t C a p t u r e ( ) ; 
 
                                                         } 
 
 
 
                                           s t o p P r o p a g a t i o n ( e v t ) ; 
 
 
 
                                           f u n c t i o n   m o v e H a n d l e r ( e v t ) 
 
                                                 { i f   ( ! e v t )   { e v t   =   w i n d o w . e v e n t ; } 
 
 
 
                                                   e l T o D r a g . s t y l e . l e f t   =   ( e v t . c l i e n t X - d e l t a X ) + ' p x ' ; 
 
                                                   e l T o D r a g . s t y l e . t o p     =   ( e v t . c l i e n t Y - d e l t a Y ) + ' p x ' ; 
 
 
 
                                                   g e t E l ( c a l I d + ' I f r a m e ' ) . s t y l e . l e f t   =   ( e v t . c l i e n t X - d e l t a X ) + ' p x ' ; 
 
                                                   g e t E l ( c a l I d + ' I f r a m e ' ) . s t y l e . t o p     =   ( e v t . c l i e n t Y - d e l t a Y ) + ' p x ' ; 
 
 
 
                                                   s t o p P r o p a g a t i o n ( e v t ) ; 
 
                                                 } ; 
 
 
 
                                           f u n c t i o n   u p H a n d l e r ( e v t ) 
 
                                                 { i f   ( ! e v t )   { e v t   =   w i n d o w . e v e n t ; } 
 
 
 
                                                   i f   ( d o c u m e n t . r e m o v e E v e n t L i s t e n e r ) 
 
                                                                 { e l T o D r a g . r e m o v e E v e n t L i s t e n e r ( ' m o u s e m o v e ' , m o v e H a n d l e r , t r u e ) ; 
 
                                                                   e l T o D r a g . r e m o v e E v e n t L i s t e n e r (     ' m o u s e u p ' ,     u p H a n d l e r , t r u e ) ; 
 
                                                                 } 
 
                                                   e l s e       { e l T o D r a g . d e t a c h E v e n t ( ' o n m o u s e u p ' ,         u p H a n d l e r ) ; 
 
                                                                   e l T o D r a g . d e t a c h E v e n t ( ' o n m o u s e m o v e ' , m o v e H a n d l e r ) ; 
 
                                                                   e l T o D r a g . r e l e a s e C a p t u r e ( ) ; 
 
                                                                 } 
 
 
 
                                                   s t o p P r o p a g a t i o n ( e v t ) ; 
 
                                                 } ; 
 
                                         } ; 
 
 
 
                                   D I V j a c s D r a g T e x t                       =   d o c u m e n t . c r e a t e E l e m e n t ( ' s p a n ' ) ; 
 
                                   D I V j a c s D r a g T e x t . i d                 =   c a l I d + ' D r a g T e x t ' ; 
 
 
 
                                   T R j a c s H e a d                                 =   d o c u m e n t . c r e a t e E l e m e n t ( ' t r ' ) ; 
 
                                   T R j a c s H e a d . c l a s s N a m e             =   ' j a c s H e a d ' ; 
 
 
 
                                   T D j a c s H e a d 1                               =   d o c u m e n t . c r e a t e E l e m e n t ( ' t d ' ) ; 
 
                                   T D j a c s H e a d 1 . c l a s s N a m e           =   ' j a c s H e a d ' ; 
 
 
 
                                   I N P U T j a c s H e a d 1                         =   d o c u m e n t . c r e a t e E l e m e n t ( ' i n p u t ' ) ; 
 
                                   I N P U T j a c s H e a d 1 . c l a s s N a m e     =   ' j a c s H e a d ' ; 
 
                                   I N P U T j a c s H e a d 1 . i d                   =   c a l I d + ' H e a d L e f t ' ; 
 
                                   I N P U T j a c s H e a d 1 . t y p e               =   ' b u t t o n ' ; 
 
                                   I N P U T j a c s H e a d 1 . t a b I n d e x       =   ' - 1 ' ; 
 
                                   I N P U T j a c s H e a d 1 . v a l u e             =   ' < ' ; 
 
                                   I N P U T j a c s H e a d 1 . o n c l i c k         =   f u n c t i o n ( )   { s h o w M o n t h ( - 1 , c a l I d ) ; } 
 
 
 
                                   T D j a c s H e a d 2                               =   d o c u m e n t . c r e a t e E l e m e n t ( ' t d ' ) ; 
 
                                   T D j a c s H e a d 2 . c l a s s N a m e           =   ' j a c s H e a d ' ; 
 
 
 
                                   S E L E C T j a c s H e a d 2                       =   d o c u m e n t . c r e a t e E l e m e n t ( ' s e l e c t ' ) ; 
 
                                   S E L E C T j a c s H e a d 2 . c l a s s N a m e   =   ' j a c s H e a d ' ; 
 
                                   S E L E C T j a c s H e a d 2 . i d                 =   c a l I d + ' M o n t h s ' ; 
 
                                   S E L E C T j a c s H e a d 2 . t a b I n d e x     =   ' - 1 ' ; 
 
                                   S E L E C T j a c s H e a d 2 . o n c h a n g e     =   f u n c t i o n ( )   { s h o w M o n t h ( 0 , c a l I d ) ; } 
 
 
 
                                   T D j a c s H e a d 3                               =   d o c u m e n t . c r e a t e E l e m e n t ( ' t d ' ) ; 
 
                                   T D j a c s H e a d 3 . c l a s s N a m e           =   ' j a c s H e a d ' ; 
 
 
 
                                   S E L E C T j a c s H e a d 3                       =   d o c u m e n t . c r e a t e E l e m e n t ( ' s e l e c t ' ) ; 
 
                                   S E L E C T j a c s H e a d 3 . c l a s s N a m e   =   ' j a c s H e a d ' ; 
 
                                   S E L E C T j a c s H e a d 3 . i d                 =   c a l I d + ' Y e a r s ' ; 
 
                                   S E L E C T j a c s H e a d 3 . t a b I n d e x     =   ' - 1 ' ; 
 
                                   S E L E C T j a c s H e a d 3 . o n c h a n g e     =   f u n c t i o n ( )   { s h o w M o n t h ( 0 , c a l I d ) ; } 
 
 
 
                                   T D j a c s H e a d 4                               =   d o c u m e n t . c r e a t e E l e m e n t ( ' t d ' ) ; 
 
                                   T D j a c s H e a d 4 . c l a s s N a m e           =   ' j a c s H e a d ' ; 
 
 
 
                                   I N P U T j a c s H e a d 4                         =   d o c u m e n t . c r e a t e E l e m e n t ( ' i n p u t ' ) ; 
 
                                   I N P U T j a c s H e a d 4 . c l a s s N a m e     =   ' j a c s H e a d ' ; 
 
                                   I N P U T j a c s H e a d 4 . i d                   =   c a l I d + ' H e a d R i g h t ' ; 
 
                                   I N P U T j a c s H e a d 4 . t y p e               =   ' b u t t o n ' ; 
 
                                   I N P U T j a c s H e a d 4 . t a b I n d e x       =   ' - 1 ' ; 
 
                                   I N P U T j a c s H e a d 4 . v a l u e             =   ' > ' ; 
 
                                   I N P U T j a c s H e a d 4 . o n c l i c k         =   f u n c t i o n ( )   { s h o w M o n t h ( 1 , c a l I d ) ; } 
 
 
 
                                   T R j a c s 2                                       =   d o c u m e n t . c r e a t e E l e m e n t ( ' t r ' ) ; 
 
                                   T R j a c s 2 . c l a s s N a m e                   =   ' j a c s ' ; 
 
 
 
                                   T D j a c s 2                                       =   d o c u m e n t . c r e a t e E l e m e n t ( ' t d ' ) ; 
 
                                   T D j a c s 2 . c l a s s N a m e                   =   ' j a c s ' ; 
 
 
 
                                   T A B L E j a c s C e l l s                         =   d o c u m e n t . c r e a t e E l e m e n t ( ' t a b l e ' ) ; 
 
                                   T A B L E j a c s C e l l s . c l a s s N a m e     =   ' j a c s C e l l s ' ; 
 
                                   T A B L E j a c s C e l l s . a l i g n             =   ' c e n t e r ' ; 
 
                                   T A B L E j a c s C e l l s . w i d t h             =   ' 1 0 0 % ' ; 
 
 
 
                                   T H E A D j a c s C e l l s                         =   d o c u m e n t . c r e a t e E l e m e n t ( ' t h e a d ' ) ; 
 
                                   T R j a c s C e l l s                               =   d o c u m e n t . c r e a t e E l e m e n t ( ' t r ' ) ; 
 
                                   T D j a c s C e l l s                               =   d o c u m e n t . c r e a t e E l e m e n t ( ' t d ' ) ; 
 
                                   T D j a c s C e l l s . c l a s s N a m e           =   ' j a c s W e e k N u m b e r H e a d ' ; 
 
                                   T D j a c s C e l l s . i d                         =   c a l I d + ' W e e k _ ' ; 
 
 
 
                                   T A B L E j a c s . a p p e n d C h i l d ( T B O D Y j a c s ) ; 
 
                                   T B O D Y j a c s . a p p e n d C h i l d ( T R j a c s 1 ) ; 
 
                                         T R j a c s 1 . a p p e n d C h i l d ( T D j a c s 1 ) ; 
 
                                                 T D j a c s 1 . a p p e n d C h i l d ( T A B L E j a c s H e a d ) ; 
 
                                                         T A B L E j a c s H e a d . a p p e n d C h i l d ( T B O D Y j a c s H e a d ) ; 
 
                                                                   T B O D Y j a c s H e a d . a p p e n d C h i l d ( T R j a c s D r a g ) ; 
 
                                                                         T R j a c s D r a g . a p p e n d C h i l d ( T D j a c s D r a g ) ; 
 
                                                                                 T D j a c s D r a g . a p p e n d C h i l d ( D I V j a c s D r a g T e x t ) ; 
 
                                                                   T B O D Y j a c s H e a d . a p p e n d C h i l d ( T R j a c s H e a d ) ; 
 
                                                                         T R j a c s H e a d . a p p e n d C h i l d ( T D j a c s H e a d 3 ) ; 
 
                                                                                 T D j a c s H e a d 3 . a p p e n d C h i l d ( S E L E C T j a c s H e a d 3 ) ; 
 
                                                                         T R j a c s H e a d . a p p e n d C h i l d ( T D j a c s H e a d 1 ) ; 
 
                                                                                 T D j a c s H e a d 1 . a p p e n d C h i l d ( I N P U T j a c s H e a d 1 ) ; 
 
                                                                         T R j a c s H e a d . a p p e n d C h i l d ( T D j a c s H e a d 2 ) ; 
 
                                                                                 T D j a c s H e a d 2 . a p p e n d C h i l d ( S E L E C T j a c s H e a d 2 ) ; 
 
                                                                         T R j a c s H e a d . a p p e n d C h i l d ( T D j a c s H e a d 4 ) ; 
 
                                                                                 T D j a c s H e a d 4 . a p p e n d C h i l d ( I N P U T j a c s H e a d 4 ) ; 
 
                                   T B O D Y j a c s . a p p e n d C h i l d ( T R j a c s 2 ) ; 
 
                                         T R j a c s 2 . a p p e n d C h i l d ( T D j a c s 2 ) ; 
 
                                                 T D j a c s 2 . a p p e n d C h i l d ( T A B L E j a c s C e l l s ) ; 
 
                                                         T A B L E j a c s C e l l s . a p p e n d C h i l d ( T H E A D j a c s C e l l s ) ; 
 
                                                                 T H E A D j a c s C e l l s . a p p e n d C h i l d ( T R j a c s C e l l s ) ; 
 
                                                                         T R j a c s C e l l s . a p p e n d C h i l d ( T D j a c s C e l l s ) ; 
 
 
 
                                                                         f o r   ( v a r   i = 0 ; i < 7 ; i + + ) 
 
                                                                                 { T D j a c s C e l l s                       =   d o c u m e n t . c r e a t e E l e m e n t ( ' t d ' ) ; 
 
                                                                                   T D j a c s C e l l s . c l a s s N a m e   =   ' j a c s W e e k ' ; 
 
                                                                                   T D j a c s C e l l s . i d                 =   c a l I d + ' W e e k I n i t ' + i ; 
 
                                                                                   T R j a c s C e l l s . a p p e n d C h i l d ( T D j a c s C e l l s ) ; 
 
                                                                                 } 
 
 
 
                                                         T B O D Y j a c s C e l l s         =   d o c u m e n t . c r e a t e E l e m e n t ( ' t b o d y ' ) ; 
 
                                                         T B O D Y j a c s C e l l s . i d   =   c a l I d + ' C e l l s ' ; 
 
 
 
                                                         T A B L E j a c s C e l l s . a p p e n d C h i l d ( T B O D Y j a c s C e l l s ) ; 
 
 
 
                                                         f o r   ( v a r   i = 0 ; i < 6 ; i + + ) 
 
                                                                 { T R j a c s C e l l s                             =   d o c u m e n t . c r e a t e E l e m e n t ( ' t r ' ) ; 
 
                                                                   T B O D Y j a c s C e l l s . a p p e n d C h i l d ( T R j a c s C e l l s ) ; 
 
 
 
                                                                         T D j a c s C e l l s                       =   d o c u m e n t . c r e a t e E l e m e n t ( ' t d ' ) ; 
 
                                                                         T D j a c s C e l l s . c l a s s N a m e   =   ' j a c s W e e k N o ' ; 
 
                                                                         T D j a c s C e l l s . i d                 =   c a l I d + ' W e e k _ ' + i ; 
 
                                                                         T R j a c s C e l l s . a p p e n d C h i l d ( T D j a c s C e l l s ) ; 
 
 
 
                                                                         f o r   ( v a r   j = 0 ; j < 7 ; j + + ) 
 
                                                                                 { T D j a c s C e l l s                       =   d o c u m e n t . c r e a t e E l e m e n t ( ' t d ' ) ; 
 
                                                                                   T D j a c s C e l l s . c l a s s N a m e   =   ' j a c s C e l l s ' ; 
 
                                                                                   T D j a c s C e l l s . i d                 =   c a l I d + ' C e l l _ ' + ( j + ( i * 7 ) ) ; 
 
                                                                                   T R j a c s C e l l s . a p p e n d C h i l d ( T D j a c s C e l l s ) ; 
 
                                                                                 } 
 
                                                                 } 
 
 
 
                                   T F O O T j a c s F o o t                       =   d o c u m e n t . c r e a t e E l e m e n t ( ' t f o o t ' ) ; 
 
                                   T A B L E j a c s C e l l s . a p p e n d C h i l d ( T F O O T j a c s F o o t ) ; 
 
 
 
                                         T R j a c s F o o t                             =   d o c u m e n t . c r e a t e E l e m e n t ( ' t r ' ) ; 
 
                                         T R j a c s F o o t . i d                       =   c a l I d + ' F o o t ' ; 
 
                                         T F O O T j a c s F o o t . a p p e n d C h i l d ( T R j a c s F o o t ) ; 
 
 
 
                                         T D j a c s F o o t                               =   d o c u m e n t . c r e a t e E l e m e n t ( ' t d ' ) ; 
 
                                         T D j a c s F o o t . c o l S p a n               =   ' 8 ' ; 
 
                                         T D j a c s F o o t . s t y l e . p a d d i n g   =   ' 0 p x ' ; 
 
                                         T R j a c s F o o t . a p p e n d C h i l d ( T D j a c s F o o t ) ; 
 
 
 
                                                 T A B L E j a c s F o o t D e t a i l   =   d o c u m e n t . c r e a t e E l e m e n t ( ' t a b l e ' ) ; 
 
                                                 T A B L E j a c s F o o t D e t a i l . s t y l e . w i d t h   =   ' 1 0 0 % ' ; 
 
                                                 T A B L E j a c s F o o t D e t a i l . c e l l S p a c i n g   =   ' 0 ' ; 
 
                                                 T A B L E j a c s F o o t D e t a i l . c e l l P a d d i n g   =   ' 0 ' ; 
 
                                                 T D j a c s F o o t . a p p e n d C h i l d ( T A B L E j a c s F o o t D e t a i l ) ; 
 
 
 
                                                         T B O D Y j a c s F o o t D e t a i l   =   d o c u m e n t . c r e a t e E l e m e n t ( ' t b o d y ' ) ; 
 
                                                         T A B L E j a c s F o o t D e t a i l . a p p e n d C h i l d ( T B O D Y j a c s F o o t D e t a i l ) ; 
 
 
 
                                                                 T R j a c s F o o t D e t a i l   =   d o c u m e n t . c r e a t e E l e m e n t ( ' t r ' ) ; 
 
                                                                 T B O D Y j a c s F o o t D e t a i l . a p p e n d C h i l d ( T R j a c s F o o t D e t a i l ) ; 
 
 
 
                                                                         T D j a c s F o o t D e t a i l                       =   d o c u m e n t . c r e a t e E l e m e n t ( ' t d ' ) ; 
 
                                                                         T D j a c s F o o t D e t a i l . c l a s s N a m e   =   ' j a c s C l e a r ' ; 
 
                                                                         T D j a c s F o o t D e t a i l . i d                 =   c a l I d + ' C l e a r ' ; 
 
                                                                         T D j a c s F o o t D e t a i l . s t y l e . p a d d i n g   =   ' 0 p x ' ; 
 
                                                                         T R j a c s F o o t D e t a i l . a p p e n d C h i l d ( T D j a c s F o o t D e t a i l ) ; 
 
 
 
                                                                                 I N P U T j a c s C l e a r B u t t o n                       =   d o c u m e n t . c r e a t e E l e m e n t ( ' i n p u t ' ) ; 
 
                                                                                 I N P U T j a c s C l e a r B u t t o n . t y p e             =   ' b u t t o n ' ; 
 
                                                                                 I N P U T j a c s C l e a r B u t t o n . i d                 =   c a l I d + ' C l e a r B u t t o n ' ; 
 
                                                                                 I N P U T j a c s C l e a r B u t t o n . c l a s s N a m e   =   ' C l e a r ' ; 
 
                                                                                 I N P U T j a c s C l e a r B u t t o n . s t y l e . t e x t A l i g n   =   ' c e n t e r ' ; 
 
                                                                                 I N P U T j a c s C l e a r B u t t o n . o n c l i c k       =   f u n c t i o n ( )   { c a l . t a r g e t E l e . v a l u e = ' ' ; h i d e ( c a l I d ) ; } ; 
 
                                                                                 T D j a c s F o o t D e t a i l . a p p e n d C h i l d ( I N P U T j a c s C l e a r B u t t o n ) ; 
 
 
 
                                                                         T D j a c s N o w                                   =   d o c u m e n t . c r e a t e E l e m e n t ( ' t d ' ) ; 
 
                                                                         T D j a c s N o w . c l a s s N a m e               =   ' j a c s N o w ' ; 
 
                                                                         T D j a c s N o w . i d                             =   c a l I d + ' N o w ' ; 
 
                                                                         T D j a c s N o w . s t y l e . p a d d i n g       =   ' 0 p x ' ; 
 
                                                                         T R j a c s F o o t D e t a i l . a p p e n d C h i l d ( T D j a c s N o w ) ; 
 
 
 
                                   i f   ( T A B L E j a c s . c l i c k T o H i d e ) 
 
                                         { i f   ( d o c u m e n t . a d d E v e n t L i s t e n e r ) 
 
                                                         {             T A B L E j a c s . a d d E v e n t L i s t e n e r ( ' c l i c k ' ,         c a n c e l ,                   f a l s e ) ; 
 
                                                                       T A B L E j a c s . a d d E v e n t L i s t e n e r ( ' c h a n g e ' ,       c a n c e l ,                   f a l s e ) ; 
 
                                                                     T D j a c s D r a g . a d d E v e n t L i s t e n e r ( ' m o u s e d o w n ' , b e g i n D r a g ,             f a l s e ) ; 
 
                                                             I N P U T j a c s H e a d 1 . a d d E v e n t L i s t e n e r ( ' c l i c k ' ,         s t o p P r o p a g a t i o n , f a l s e ) ; 
 
                                                           S E L E C T j a c s H e a d 2 . a d d E v e n t L i s t e n e r ( ' c l i c k ' ,         s t o p P r o p a g a t i o n , f a l s e ) ; 
 
                                                           S E L E C T j a c s H e a d 2 . a d d E v e n t L i s t e n e r ( ' c h a n g e ' ,       s t o p P r o p a g a t i o n , f a l s e ) ; 
 
                                                           S E L E C T j a c s H e a d 3 . a d d E v e n t L i s t e n e r ( ' c l i c k ' ,         s t o p P r o p a g a t i o n , f a l s e ) ; 
 
                                                           S E L E C T j a c s H e a d 3 . a d d E v e n t L i s t e n e r ( ' c h a n g e ' ,       s t o p P r o p a g a t i o n , f a l s e ) ; 
 
                                                             I N P U T j a c s H e a d 4 . a d d E v e n t L i s t e n e r ( ' c l i c k ' ,         s t o p P r o p a g a t i o n , f a l s e ) ; 
 
                                                             T B O D Y j a c s C e l l s . a d d E v e n t L i s t e n e r ( ' c l i c k ' ,         s t o p P r o p a g a t i o n , f a l s e ) ; 
 
                                                         } 
 
                                           e l s e       {             T A B L E j a c s . a t t a c h E v e n t ( ' o n c l i c k ' ,         c a n c e l ) ; 
 
                                                                       T A B L E j a c s . a t t a c h E v e n t ( ' o n c h a n g e ' ,       c a n c e l ) ; 
 
                                                                     T D j a c s D r a g . a t t a c h E v e n t ( ' o n m o u s e d o w n ' , b e g i n D r a g ) ; 
 
                                                             I N P U T j a c s H e a d 1 . a t t a c h E v e n t ( ' o n c l i c k ' ,         s t o p P r o p a g a t i o n ) ; 
 
                                                           S E L E C T j a c s H e a d 2 . a t t a c h E v e n t ( ' o n c l i c k ' ,         s t o p P r o p a g a t i o n ) ; 
 
                                                           S E L E C T j a c s H e a d 2 . a t t a c h E v e n t ( ' o n c h a n g e ' ,       s t o p P r o p a g a t i o n ) ; 
 
                                                           S E L E C T j a c s H e a d 3 . a t t a c h E v e n t ( ' o n c l i c k ' ,         s t o p P r o p a g a t i o n ) ; 
 
                                                           S E L E C T j a c s H e a d 3 . a t t a c h E v e n t ( ' o n c h a n g e ' ,       s t o p P r o p a g a t i o n ) ; 
 
                                                             I N P U T j a c s H e a d 4 . a t t a c h E v e n t ( ' o n c l i c k ' ,         s t o p P r o p a g a t i o n ) ; 
 
                                                             T B O D Y j a c s C e l l s . a t t a c h E v e n t ( ' o n c l i c k ' ,         s t o p P r o p a g a t i o n ) ; 
 
                                                         } 
 
                                         } 
 
                                   e l s e 
 
                                         { i f   ( d o c u m e n t . a d d E v e n t L i s t e n e r ) 
 
                                                 {             T A B L E j a c s . a d d E v e n t L i s t e n e r ( ' c l i c k ' ,         s t o p P r o p a g a t i o n , f a l s e ) ; 
 
                                                               T A B L E j a c s . a d d E v e n t L i s t e n e r ( ' c h a n g e ' ,       s t o p P r o p a g a t i o n , f a l s e ) ; 
 
                                                             T D j a c s D r a g . a d d E v e n t L i s t e n e r ( ' m o u s e d o w n ' , b e g i n D r a g ,             f a l s e ) ; 
 
                                                 } 
 
                                           e l s e 
 
                                                 {             T A B L E j a c s . a t t a c h E v e n t ( ' o n c l i c k ' ,         s t o p P r o p a g a t i o n ) ; 
 
                                                               T A B L E j a c s . a t t a c h E v e n t ( ' o n c h a n g e ' ,       s t o p P r o p a g a t i o n ) ; 
 
                                                             T D j a c s D r a g . a t t a c h E v e n t ( ' o n m o u s e d o w n ' , b e g i n D r a g ) ; 
 
                                                 } 
 
                                         } 
 
                                   i f   ( d y n a m i c ) 
 
                                                 { i F r a m e   =   d o c u m e n t . c r e a t e E l e m e n t ( ' i f r a m e ' ) ; 
 
 
 
                                                   i F r a m e . c l a s s N a m e         =   ' j a c s ' ; 
 
                                                   i F r a m e . i d                       =   c a l I d + ' I f r a m e ' ; 
 
                                                   i f   ( g e t E l ( ' j a c s I E l t 7 ' ) )   { i F r a m e . s r c   =   ' / j a c s b l a n k . h t m l ' ; } 
 
                                                   i F r a m e . n a m e                   =   ' j a c s I f r a m e ' ; 
 
                                                   i F r a m e . f r a m e b o r d e r     =   ' 0 ' ; 
 
                                                   i F r a m e . s t y l e . z I n d e x   =   T A B L E j a c s . z I n d e x ; 
 
 
 
                                                   d o c u m e n t . b o d y . i n s e r t B e f o r e ( i F r a m e ,   d o c u m e n t . b o d y . f i r s t C h i l d ) ; 
 
                                                   d o c u m e n t . b o d y . i n s e r t B e f o r e ( T A B L E j a c s ,   i F r a m e ) ; 
 
                                                 } 
 
                                   e l s e       { i f   ( ! g e t E l ( ' j a c s S p a n ' + c a l I d ) )   { d o c u m e n t . w r i t e l n ( " < s p a n   i d = ' j a c s S p a n " + c a l I d + " ' > < / s p a n > " ) ; } 
 
                                                   g e t E l ( ' j a c s S p a n ' + c a l I d ) . a p p e n d C h i l d ( T A B L E j a c s ) ; 
 
                                                 } 
 
                                 } , 
 
 
 
                           c a l s :   f u n c t i o n   ( )     { r e t u r n   c a l s ; } , 
 
                           n e x t :   f u n c t i o n   ( ) 
 
                                 { i f   ( t y p e o f   a r g u m e n t s [ 0 ] = = ' s t r i n g ' ) 
 
                                                 { c a l I D               =   a r g u m e n t s [ 0 ] ; 
 
                                                   i n F u n c             =   a r g u m e n t s [ 1 ] ; 
 
                                                   a r g P o s i t i o n   =   2 ; 
 
                                                 } 
 
                                   e l s e       { c a l I D               =   ' j a c s ' ; 
 
                                                   i n F u n c             =   a r g u m e n t s [ 0 ] ; 
 
                                                   a r g P o s i t i o n   =   1 ; 
 
                                                 } 
 
 
 
                                   i f   ( g e t E l ( c a l I D ) ) 
 
                                         { / /   T a k e   t h e   a r g u m e n t s   t o   b e   p a s s e d   t h r o u g h   t o   t h e   d e f i n e d   f u n c t i o n . 
 
 
 
                                           v a r   a r g s   =   n e w   A r r a y ( ) ; 
 
 
 
                                           f o r   ( v a r   i = a r g P o s i t i o n ; i < a r g u m e n t s . l e n g t h ; i + + )   { a r g s . p u s h ( a r g u m e n t s [ i ] ) ; } 
 
 
 
                                           / /   P a s s   t h e m   t h r o u g h   t o   j a c s R u n N e x t 
 
 
 
                                           n e w F u n c   =   i n F u n c . j a c s R u n N e x t ( a r g s , c a l I D ) ; 
 
 
 
                                           / /   I f   t h e   f u n c t i o n   h a s   a l r e a d y   b e e n   s e t ,   c l e a r   t h e   o l d 
 
                                           / /   f u n c t i o n   a n d   s e t   t h e   n e w   o n e   ( m o s t l y   r e l e v a n t   f o r   d y n a m i c 
 
                                           / /   c a l e n d a r s   b u t   r e f r e s h i n g   t h e   f u n c t i o n   f o r   s t a t i c   c a l e n d a r s 
 
                                           / /   c a t e r s   f o r   d y n a m i c   p a r a m e t e r s ) . 
 
 
 
                                           v a r   c a l   =   g e t E l ( c a l I D ) ; 
 
 
 
                                           i f   ( c a l . d y n a m i c )   { c a l . a r r O n N e x t . p u s h ( n e w F u n c ) ; } 
 
                                           e l s e                           { c a l . o n N e x t   =   n e w F u n c ; } 
 
                                         } 
 
                                   e l s e 
 
                                         { a l e r t ( ' E R R O R :   C a l e n d a r   o b j e c t   < < '   +   c a l I D   +   ' > >   d o e s   n o t   e x i s t . \ n '   + 
 
                                                       ' P l e a s e   c h e c k   t h a t   t h e   c a l e n d a r   o b j e c t   i d   i s   c o r r e c t \ n '   + 
 
                                                       ' a n d   t h a t   J A C S . s h o w   i s   c a l l e d   b e f o r e   J A C S . n e x t . ' ) ; 
 
                                         } 
 
                                 } , 
 
                                 s e t D r o p Y e a r :   f u n c t i o n ( B a s e Y e a r , D r o p Y e a r )   { 
 
                                 	 _ b Y e a r   =   B a s e Y e a r ; 
 
                                 	 _ d Y e a r   =   D r o p Y e a r ; 
 
                                 } , 
 
                                 s e t X B a s e :   f u n c t i o n ( X B a s e )   {     / / a d d e d   b y   L e e 
 
                                 	 _ x B a s e   =   X B a s e ; 
 
                                 } , 
 
                                 s e t D a y :   f u n c t i o n ( F o r w a r d D a y ,   B a c k w a r d D a y )   {   / /   a d d   b y   c 
 
                                 	 _ f D a y   =   F o r w a r d D a y ; 
 
                                 	 _ b D a y   =   B a c k w a r d D a y ; 
 
                                 } , 
 
                                 s e t H o s t D a y :   f u n c t i o n ( H o s t D a t e ,   B a c k w a r d D a y ) 
 
                                 { 
 
                                 	 v a r   n o w = n e w   D a t e ( ) ; 
 
                                 	 _ f D a y = ( t o D a t e ( H o s t D a t e ) . g e t T i m e ( ) - n e w   D a t e ( n o w . g e t F u l l Y e a r ( ) , n o w . g e t M o n t h ( ) , n o w . g e t D a t e ( ) ) . g e t T i m e ( ) ) / 8 6 4 0 0 0 0 0 ; 
 
                                 	 _ b D a y = B a c k w a r d D a y ; 
 
                                 } , 
 
                                 d i s a b l e D a y s :   f u n c t i o n ( d L i s t ) 
 
                                 { 
 
                                 	 f o r ( v a r   i = 0 ; i < d L i s t . l e n g t h ; _ d L i s t . p u s h ( t o D a t e ( d L i s t [ i + + ] ) ) ) ; 
 
                                 } , 
 
                                 c l e a r D i s a b l e D a y s :   f u n c t i o n ( ) 
 
                                 { 
 
                                 	 _ d L i s t   =   [ ] ; 
 
                                 } 
 
                         } ; 
 
         } ; 
 
 
 
 / /   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 / /   E n d   o f   P u b l i c   F u n c t i o n   L i b r a r y 
 
 / /   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 / /   E n d   o f   J a v a s c r i p t   A d v a n c e d   C a l e n d a r   S c r i p t   ( J A C S )   C o d e 
 
 / /   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *   1       https://its.bocmacau.com/zh_CN/js/jacs.js?c=1204                       !!   	   JACS      +H!!          JACS<c    y                    P   P                          !!      dateNow	   cals
   _dList
   _bYear
   _dYear   _fDay   _bDay
   _xBase   getEl   calAttributes   jacsLoader   showMonth	   hide
   doNext   stopPropagation
   toDate         +H!!          getEl                      jS  r[  \S  r[                            !!      id         +H;     ~                  (            
T  : DB      Q       
T  :  E$      Q       
T  :    >   "             
T  :              
T  :    ?$             
T  : >7J             
T  :    ?'   $         =   T  =    Q(   Ϙ	ΘϘ
ޘʨ Ϙ 	˨ Ϙ	ʨ Ϙ 	˨ Ϙ	ʠ!Ϡ !ɨ 	    document   getElementById#   getElementsByName
   length   alert]   JACS 
Cannot uniquely identify element named:    .
More than one identical NAME attribute defined.
Solution: Assign the required element a unique ID attribute value.       5!!          calAttributes [  6  ~[  6                  5!!          jacsLoader                        C    0                             !!      defeatLeaks          +H!!    	      defeatLeaks                          5;      =                           W   Q    5   *             
=    
  B Q$             
=    
   Q    
  =   : #            
=   V    Q   ʠ
ʠט	Π֘	ɠ
ʘ՘ɨ ̠    document!   addEventListener   click   attachEvent   onclick   jacsIElt7
   window   onbeforeunload5!!          showMonth   ,   ,          9          setOutput    eventTrigger    calId    cal    startDate	      nowOutput      o    	                5	      setOutput    `    `  Z                   tagsToFind	      orderElements    4    4    /                 tabOrder    unordered    elementArrays	      elementArrays u  0  _  0    3              555	      changeClass   c  r  c    !              5	      eventTrigger     u      "              5	      weekNumber '                       5	      cellOutput     h  4              55!!       	   hide , . , .                	      hideOne - . - .                 55!!       
   doNext . %0 . %0                 5!!          stopPropagation G0 1 /0 1                 5!!       
   toDate              
       1 #2 
1 #2                          !!      d   l   n   a        +H!!
   [\-\/] !!+   (\d{4})(\d{2})(\d{2}) ;      Q          
            T  '=          T         W   Q   W  QV      
T  :        T     
V   : &   
   T     
V  :    
?:    W  Q   AV  >7      V  ?7: ?V  7,  R ʠ
  ʘʠΘؘ
ۘ˘	͠	ܘИ򰣘 
   object	   test   split   match   slice	   Date
   Number       5!!       ?   JACS</Date.prototype.jacsFormatb   n    n  \               5!!       E   JACS</String.prototype.jacsPadLeftb û  o    o                 5!!       I   JACS</Function.prototype.jacsRunNextb  D    <                  	   func 	   args   B  ƽ          $             55!!       	   showB 3 b 2 b         f          calId    dateValue	      hideOnTab S> > A> > "  #              5	      inputFormat  kR m WR m   )              55!!       	   makeB   z  *                  calId	   
   cancel       8                 5	      beginDrag ʷ    S  #       	          elToDrag 
   deltaX 
   deltaY    moveHandler    upHandler	      moveHandler /    k  )              5	      upHandler 1    w  '              55   B  : S 2 S   5              5   B   (  (   5              5   B        5              5   B  & >  >   5              5   B  > f 6 f 	  Q              55!!       	   calsB      ^	                5!!       	   nextB   k  k _	               5!!          setDropYearC 	  %                                                !!      BaseYear   DropYear         +H;                               T     QT    Qɠɠ        5!!          setXBaseC 	  "                  * x " x                           !!      XBase         +H;    
                           T   	  Qɠ        5!!       
   setDayB  "  " 	                 5!!          setHostDayC 	  $                 I S A S                           !!      HostDate   BackwardDay   now        +H;      6                          A,  R  W   Q   T  :    
:      AV      
:  V      
:  V      
:  ,  R    
:   \&   QT    QҠɘʘԘΘΘҰʘ9Рɠ 	   Date   getTime   getFullYear   getMonth   getDate       5!!          disableDaysB {  s  	  %              5!!       !   clearDisableDaysB  $ k  k 	  *              5!!    
   !!	   show!!!!	   make!!!!	   cals!!!!	   next!!!!   setDropYear!!!!   setXBase!!!!
   setDay!!!!   setHostDay!!!!   disableDays!!!!!   clearDisableDays!!    ;                      +           
  Q      Q   W   Q      Q    
  Q      Q      Q      Q    A       
    A,  R     
:  : ,  R    Q   A,  R     Q   A,  R     Q    5      6   Q   5   	   6   Q   5   
   6	   Q
   5   )            
=
   V   C Q#            
=   V    Q    [      ]      ]   
   ]      ]      ]      ]      ]      ]      ]      ]   ؠܘʘﰟɠӠӠ  M [ը ը ը 	ʠ֘Π՘ɨ ͨ  Ǩ Ҩ ب 㨀 ʨ *
ʨ 	^
ʠ
ʨ 	ʠʠʠʨ 	ʠʨ 	 	   Date   parse   toDateString   Array   prototype   jacsFormat
   String   jacsPadLeft   Function   jacsRunNext   document!   addEventListener
   window	   load   attachEvent
   onload	   show	   make	   cals	   next   setDropYear   setXBase
   setDay   setHostDay   disableDays!   clearDisableDays5;                                         A,  R      Q yӨ 	9 	   JACSЧ/2      &bbCF:b>   1    :https://its.bocmacau.com/zh_CN/js/jacs.js?c=1204 necko:classified 1 strongly-framed 1 security-info FnhllAKWRHGAlo+ESXykKAAAAAAAAAAAwAAAAAAAAEaphjojH6pBabDSgSnsfLHeAAAAAgAAAAAAAAAAAAAAAAAAAAEAMQFmCjImkVxP+7sgiYWmMt8FvcOXmlQiTNWFiWlrbpbqgwAAAAAAAAQLMIIEBzCCAu+gAwIBAgIJQgAAAN1iDwQ2MA0GCSqGSIb3DQEBCwUAMFQxGTAXBgNVBAoMEEFPIEthc3BlcnNreSBMYWIxNzA1BgNVBAMMLkthc3BlcnNreSBBbnRpLVZpcnVzIFBlcnNvbmFsIFJvb3QgQ2VydGlmaWNhdGUwHhcNMjEwODIwMDIyODA2WhcNMjIwODE5MDIyODA2WjCB6DEdMBsGA1UEDwwUUHJpdmF0ZSBPcmdhbml6YXRpb24xEzARBgsrBgEEAYI3PAIBAxMCQ04xGDAWBgsrBgEEAYI3PAIBAhMHQmVpamluZzEbMBkGA1UEBRMSOTExMDAwMDAxMDAwMDEzNDI4MQswCQYDVQQGEwJNTzEOMAwGA1UEBxMFTWFjYXUxHjAcBgNVBAoTFUJBTksgT0YgQ0hJTkEgTElNSVRFRDEjMCEGA1UECxMaQmFuayBvZiBDaGluYSBNYWNhdSBCcmFuY2gxGTAXBgNVBAMTEGl0cy5ib2NtYWNhdS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC8Mbk8JZSuoaLjhwGA7u2079onKiOJBCjF6kgrEiSsd9GABl/+73JiWlNw3OHGCS+9PdclqxmCIFo2IPihM9jDuC8cLLH9vdeyrDY6KCtg6Z9xxh9lP2RoJAfKpe5LUSNnIK+kMXIlgyE5hMhr+incWULABH9Zt/31DV+hQg7uQxQE0kTp2egLc2a0of/EPmG53MWqBgLo+QVw2Cv0Y863h7PipDUpdB4hsjszsYHpIfewb4w06qXyjGbFR7+mR1fC6j5QJ7qUMHaWo5qX+Fytmkyw3V/8OiiIkCMM5GRyoOFzphIiip1i/O37qarbD2/SDxlPJ8T5YvZgCAN4orrzAgMBAAGjRzBFMBMGA1UdJQQMMAoGCCsGAQUFBwMBMAsGA1UdDwQEAwIFoDAhBgNVHREEGjAYhwTKrzgKghBpdHMuYm9jbWFjYXUuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQBj2eG3VZqoIKhTT/6i43+JZEl5sOAX0aNagzde1C7vjPv3wkRLoqU8LGuS0Nd+TQbNHjUD5GoZfx5ZCoDXS4CuWoPVYQY+rsbXNtXiNiAAPjvS9g6usDwN+5Kdo/AKcAQrc1WpsgpWJCiLGdLlR1NWsh7SeP6QhF5C3I5pLXEjVEu5+le3UIPogV9tLiQGqiB/VC6ZPIu2eDdXeW6klaFIKWQZd+Ltu7PHcF62Qk8nvNS2pOrrQHMF3oo9fqSYWj5UxsGHAk74RoWb822mZA4g++3OizHafzuzbVO2LnVr7ZD2GzcttmsRerUuCmMgITApZRaAhZCHGkNlbn4m4mVMAC8AAwAAAAABAQAAAAAAAARub25lAAAABG5vbmUBlZ+xZWUXSH+rm9iRO+Uxl650zaXNL0c/lvXwt//2LGgAAAACZgoyJpFcT/u7IImFpjLfBb3Dl5pUIkzVhYlpa26W6oMAAAAAAAAECzCCBAcwggLvoAMCAQICCUIAAADdYg8ENjANBgkqhkiG9w0BAQsFADBUMRkwFwYDVQQKDBBBTyBLYXNwZXJza3kgTGFiMTcwNQYDVQQDDC5LYXNwZXJza3kgQW50aS1WaXJ1cyBQZXJzb25hbCBSb290IENlcnRpZmljYXRlMB4XDTIxMDgyMDAyMjgwNloXDTIyMDgxOTAyMjgwNlowgegxHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5pemF0aW9uMRMwEQYLKwYBBAGCNzwCAQMTAkNOMRgwFgYLKwYBBAGCNzwCAQITB0JlaWppbmcxGzAZBgNVBAUTEjkxMTAwMDAwMTAwMDAxMzQyODELMAkGA1UEBhMCTU8xDjAMBgNVBAcTBU1hY2F1MR4wHAYDVQQKExVCQU5LIE9GIENISU5BIExJTUlURUQxIzAhBgNVBAsTGkJhbmsgb2YgQ2hpbmEgTWFjYXUgQnJhbmNoMRkwFwYDVQQDExBpdHMuYm9jbWFjYXUuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvDG5PCWUrqGi44cBgO7ttO/aJyojiQQoxepIKxIkrHfRgAZf/u9yYlpTcNzhxgkvvT3XJasZgiBaNiD4oTPYw7gvHCyx/b3Xsqw2OigrYOmfccYfZT9kaCQHyqXuS1EjZyCvpDFyJYMhOYTIa/op3FlCwAR/Wbf99Q1foUIO7kMUBNJE6dnoC3NmtKH/xD5hudzFqgYC6PkFcNgr9GPOt4ez4qQ1KXQeIbI7M7GB6SH3sG+MNOql8oxmxUe/pkdXwuo+UCe6lDB2lqOal/hcrZpMsN1f/DooiJAjDORkcqDhc6YSIoqdYvzt+6mq2w9v0g8ZTyfE+WL2YAgDeKK68wIDAQABo0cwRTATBgNVHSUEDDAKBggrBgEFBQcDATALBgNVHQ8EBAMCBaAwIQYDVR0RBBowGIcEyq84CoIQaXRzLmJvY21hY2F1LmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAY9nht1WaqCCoU0/+ouN/iWRJebDgF9GjWoM3XtQu74z798JES6KlPCxrktDXfk0GzR41A+RqGX8eWQqA10uArlqD1WEGPq7G1zbV4jYgAD470vYOrrA8DfuSnaPwCnAEK3NVqbIKViQoixnS5UdTVrIe0nj+kIReQtyOaS1xI1RLufpXt1CD6IFfbS4kBqogf1QumTyLtng3V3lupJWhSClkGXfi7buzx3BetkJPJ7zUtqTq60BzBd6KPX6kmFo+VMbBhwJO+EaFm/NtpmQOIPvtzosx2n87s21Tti51a+2Q9hs3LbZrEXq1LgpjICEwKWUWgIWQhxpDZW5+JuJlTGYKMiaRXE/7uyCJhaYy3wW9w5eaVCJM1YWJaWtuluqDAAAAAAAAA5swggOXMIICf6ADAgECAglBAAAAAWHYcyAwDQYJKoZIhvcNAQELBQAwVDEZMBcGA1UECgwQQU8gS2FzcGVyc2t5IExhYjE3MDUGA1UEAwwuS2FzcGVyc2t5IEFudGktVmlydXMgUGVyc29uYWwgUm9vdCBDZXJ0aWZpY2F0ZTAeFw0xMjAxMTAxNzA2NDBaFw0zMjAxMDUxNzA2NDBaMFQxGTAXBgNVBAoMEEFPIEthc3BlcnNreSBMYWIxNzA1BgNVBAMMLkthc3BlcnNreSBBbnRpLVZpcnVzIFBlcnNvbmFsIFJvb3QgQ2VydGlmaWNhdGUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC8Mbk8JZSuoaLjhwGA7u2079onKiOJBCjF6kgrEiSsd9GABl/+73JiWlNw3OHGCS+9PdclqxmCIFo2IPihM9jDuC8cLLH9vdeyrDY6KCtg6Z9xxh9lP2RoJAfKpe5LUSNnIK+kMXIlgyE5hMhr+incWULABH9Zt/31DV+hQg7uQxQE0kTp2egLc2a0of/EPmG53MWqBgLo+QVw2Cv0Y863h7PipDUpdB4hsjszsYHpIfewb4w06qXyjGbFR7+mR1fC6j5QJ7qUMHaWo5qX+Fytmkyw3V/8OiiIkCMM5GRyoOFzphIiip1i/O37qarbD2/SDxlPJ8T5YvZgCAN4orrzAgMBAAGjbDBqMA8GA1UdEwEB/wQFMAMBAf8wNQYJYIZIAYb4QgENBCgWJns0MThFOUUwMy1EMTAzLTQzQzAtOEQ5QS0yNTUwQjhFQzk0NEV9MAsGA1UdDwQEAwICBDATBgNVHSUEDDAKBggrBgEFBQcDATANBgkqhkiG9w0BAQsFAAOCAQEArrgujIAvdjlhzGSuU9WhEhyIzUFTIeBFWEb02PmH4j38yahsGX1cbEaozK0FX2XogFMzDQYEuJMcpIECjhEqsnidnzt429nku+VDEBMG9GCpX+jUwn+wSdxkonDZHNpOvfdF21sKoXomQ8ciwiJYf8A1aeavIZRvoti04Q0iRIPQwt+ZrOWUw9nqrbDKe4S4Pg2RaaNxbrO+E9NMdB2Otl56Oi8o8dCjq+RD8ZfdhQ1H3kqWY/egB9NqQNHpMEFD6KVR377o5bG02U19HMpGRseJtfhFW31HwXnSIqOCqksLm1DM0IsLxoF7xPb4g4ZbswmA6RTiT+fu+qpbMuEVsQA= request-method GET response-head HTTP/1.1 200 OK
Last-Modified: Tue, 13 Jun 2017 03:32:12 GMT
ETag: "1ffaa-551cf14c3a700"
Accept-Ranges: bytes
Content-Length: 130986
Content-Type: application/x-javascript
Date: Fri, 18 Feb 2022 02:29:19 GMT
 original-response-headers Date: Sat, 08 Jan 2022 08:41:02 GMT
Last-Modified: Tue, 13 Jun 2017 03:32:12 GMT
ETag: "1ffaa-551cf14c3a700"
Accept-Ranges: bytes
Content-Length: 130986
Keep-Alive: timeout=10, max=482
Connection: Keep-Alive
Content-Type: application/x-javascript
 ctid 2 eTLD1Access 1;0;21925653, uncompressed-len 0 net-response-time-onstart 107 net-response-time-onstop 107 alt-data 1;130986,javascript/moz-bytecode-20190705221915 alt-data-from-child 1  